Skip to content

Commit 5ddb463

Browse files
committed
Fixed "Switching between path mode and command mode a couple of times causes crash"
1 parent fcba4fe commit 5ddb463

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,8 @@ public bool IsOmnibarFocused
253253
_ = PopulateOmnibarSuggestionsForPathMode();
254254
break;
255255
case OmnibarPaletteModeName:
256-
PopulateOmnibarSuggestionsForCommandPaletteMode();
256+
if (OmnibarCommandPaletteModeSuggestionItems.Count is 0)
257+
PopulateOmnibarSuggestionsForCommandPaletteMode();
257258
break;
258259
case OmnibarSearchModeName:
259260
break;
@@ -282,7 +283,8 @@ public string OmnibarCurrentSelectedModeName
282283
_ = PopulateOmnibarSuggestionsForPathMode();
283284
break;
284285
case OmnibarPaletteModeName:
285-
PopulateOmnibarSuggestionsForCommandPaletteMode();
286+
if (OmnibarCommandPaletteModeSuggestionItems.Count is 0)
287+
PopulateOmnibarSuggestionsForCommandPaletteMode();
286288
break;
287289
case OmnibarSearchModeName:
288290
break;
@@ -1100,8 +1102,6 @@ private static async Task<bool> LaunchApplicationFromPath(string currentInput, s
11001102

11011103
public async Task PopulateOmnibarSuggestionsForPathMode()
11021104
{
1103-
PathModeSuggestionItems.Clear();
1104-
11051105
var result = await SafetyExtensions.IgnoreExceptions((Func<Task<bool>>)(async () =>
11061106
{
11071107
List<OmnibarPathModeSuggestionModel>? newSuggestions = [];

0 commit comments

Comments
 (0)