Skip to content

Commit

Permalink
Fix a crash that can happen when setting SelectFolderDialog.Directory…
Browse files Browse the repository at this point in the history
… on Mac
  • Loading branch information
cwensley committed Nov 17, 2023
1 parent 16f4a08 commit 987b039
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Eto.Mac/Forms/SelectFolderDialogHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,17 @@ public string Title
public string Directory
{
get => Control.Url?.Path ?? Control.DirectoryUrl.Path;
set => Control.DirectoryUrl = NSUrl.FromFilename(value);
set
{
try
{
Control.DirectoryUrl = new NSUrl(value, true);
}
catch
{
// ignore errors, can crash depending on the value when [NSUrl initFileURLWithPath:isDirectory:] returns nil
}
}
}

}
Expand Down

0 comments on commit 987b039

Please sign in to comment.