From 595c9efb251abdadd9cefa8c18e64278548d2f87 Mon Sep 17 00:00:00 2001 From: dengfuyuan Date: Mon, 23 Sep 2024 14:25:27 +0800 Subject: [PATCH] fix: application crashes on canceling folder selection --- PromptPlayground/Views/MainView.axaml.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/PromptPlayground/Views/MainView.axaml.cs b/PromptPlayground/Views/MainView.axaml.cs index 32cf7c8..dbee566 100644 --- a/PromptPlayground/Views/MainView.axaml.cs +++ b/PromptPlayground/Views/MainView.axaml.cs @@ -79,9 +79,16 @@ private void OnConfigClick(object sender, RoutedEventArgs e) { AllowMultiple = false }); + + if(folders == null || folders.Count == 0) + { + return null; + } + var folder = folders[0]?.TryGetLocalPath(); return folder; } + private async Task FileOpenAsync() { var file = await TopLevel.GetTopLevel(this)!.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions()