Closed riveranb closed 5 years ago
If it returns null, it will not ever reach that second return statement. I think your problem lies somewhere else.
NullReferenceException happens at StandaloneFileBrowserLinux.cs, line 45 and line 63,
return paths.Split((char)28);
Because paths is null, So I just try to avoid NullReferenceException in my use cases.
I could not find the null error when pressing CANCEL, but I did find it when pressing X. It appears they are different events on GTK.
I made a patch and will make a pull request soon.
When using StandaloneFileBrowser in Linux OS (ubuntu), if I choose "CANCEL" or "ESC" in file browse dialog, the returned (string[])paths become null. And will become NullReferenceException at paths.Split(...);
` public string[] OpenFilePanel(string title, string directory, ExtensionFilter[] extensions, bool multiselect) { var paths = Marshal.PtrToStringAnsi(DialogOpenFilePanel( title, directory, GetFilterFromFileExtensionList(extensions), multiselect));
` public string[] OpenFolderPanel(string title, string directory, bool multiselect) { var paths = Marshal.PtrToStringAnsi(DialogOpenFolderPanel( title, directory, multiselect));