Skip to content

Commit 5c97e78

Browse files
committed
Check null empty ealier
1 parent b8768fe commit 5c97e78

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ private void SelectPath_OnClick(object commandParameter, RoutedEventArgs e)
172172
CheckPathExists = true
173173
};
174174

175-
if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
175+
if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK ||
176+
string.IsNullOrEmpty(dialog.FileName))
176177
return;
177178

178179
SelectedPath = dialog.FileName;
@@ -184,7 +185,8 @@ private void SelectPath_OnClick(object commandParameter, RoutedEventArgs e)
184185
ShowNewFolderButton = true
185186
};
186187

187-
if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
188+
if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK ||
189+
string.IsNullOrEmpty(dialog.SelectedPath))
188190
return;
189191

190192
SelectedPath = dialog.SelectedPath;
@@ -195,11 +197,6 @@ private void SelectPath_OnClick(object commandParameter, RoutedEventArgs e)
195197

196198
private static ResultType GetResultType(string path)
197199
{
198-
if (string.IsNullOrEmpty(path))
199-
{
200-
return ResultType.Folder;
201-
}
202-
203200
// Check if the path is a file or folder
204201
if (System.IO.File.Exists(path))
205202
{
@@ -218,6 +215,7 @@ private static ResultType GetResultType(string path)
218215
}
219216
else
220217
{
218+
// This should not happen, but just in case, we assume it's a folder
221219
return ResultType.Folder;
222220
}
223221
}

0 commit comments

Comments
 (0)