Browse Source

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

fixes null reference exception on gtk backend.
pull/806/merge
Nikita Tsukanov 9 years ago
committed by GitHub
parent
commit
823fda9e5a
  1. 4
      src/Gtk/Avalonia.Gtk/SystemDialogImpl.cs

4
src/Gtk/Avalonia.Gtk/SystemDialogImpl.cs

@ -15,7 +15,7 @@ namespace Avalonia.Gtk
public Task<string[]> ShowFileDialogAsync(FileDialog dialog, IWindowImpl parent) public Task<string[]> ShowFileDialogAsync(FileDialog dialog, IWindowImpl parent)
{ {
var tcs = new TaskCompletionSource<string[]>(); 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 dialog is OpenFileDialog
? FileChooserAction.Open ? FileChooserAction.Open
: FileChooserAction.Save, : FileChooserAction.Save,
@ -57,7 +57,7 @@ namespace Avalonia.Gtk
public Task<string> ShowFolderDialogAsync(OpenFolderDialog dialog, IWindowImpl parent) public Task<string> ShowFolderDialogAsync(OpenFolderDialog dialog, IWindowImpl parent)
{ {
var tcs = new TaskCompletionSource<string>(); 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, FileChooserAction.SelectFolder,
"Cancel", ResponseType.Cancel, "Cancel", ResponseType.Cancel,
"Select Folder", ResponseType.Accept) "Select Folder", ResponseType.Accept)

Loading…
Cancel
Save