소스 검색

Merge pull request #876 from VitalElement/fixes/gtk-system-dialog-nullref-exception

fixes null reference exception on gtk backend.
Nikita Tsukanov 8 년 전
부모
커밋
823fda9e5a
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      src/Gtk/Avalonia.Gtk/SystemDialogImpl.cs

+ 2 - 2
src/Gtk/Avalonia.Gtk/SystemDialogImpl.cs

@@ -15,7 +15,7 @@ namespace Avalonia.Gtk
         public Task<string[]> ShowFileDialogAsync(FileDialog dialog, IWindowImpl parent)
         {
             var tcs = new TaskCompletionSource<string[]>();
-            var dlg = new global::Gtk.FileChooserDialog(dialog.Title, ((WindowImplBase)parent).Widget.Toplevel as Window, 
+            var dlg = new global::Gtk.FileChooserDialog(dialog.Title, ((WindowImplBase)parent)?.Widget.Toplevel as Window, 
                 dialog is OpenFileDialog
                     ? FileChooserAction.Open
                     : FileChooserAction.Save,
@@ -57,7 +57,7 @@ namespace Avalonia.Gtk
         public Task<string> ShowFolderDialogAsync(OpenFolderDialog dialog, IWindowImpl parent)
         {
             var tcs = new TaskCompletionSource<string>();
-            var dlg = new global::Gtk.FileChooserDialog(dialog.Title, ((WindowImplBase)parent).Widget.Toplevel as Window, 
+            var dlg = new global::Gtk.FileChooserDialog(dialog.Title, ((WindowImplBase)parent)?.Widget.Toplevel as Window, 
                 FileChooserAction.SelectFolder,
                 "Cancel", ResponseType.Cancel,
                 "Select Folder", ResponseType.Accept)