Skip to content

Commit 9d879a9

Browse files
authored
Code Quality: Fixed Omnibar navigation in search results (#17304)
1 parent 9b806b3 commit 9d879a9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -499,12 +499,13 @@ await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(
499499

500500
public async Task HandleItemNavigationAsync(string path)
501501
{
502-
if (ContentPageContext.ShellPage is null || PathComponents.LastOrDefault()?.Path is not { } currentPath)
502+
if (ContentPageContext.ShellPage is null)
503503
return;
504504

505+
var currentPath = PathComponents.LastOrDefault()?.Path;
505506
var isFtp = FtpHelpers.IsFtpPath(path);
506507
var normalizedInput = NormalizePathInput(path, isFtp);
507-
if (currentPath.Equals(normalizedInput, StringComparison.OrdinalIgnoreCase) ||
508+
if (currentPath is not null && currentPath.Equals(normalizedInput, StringComparison.OrdinalIgnoreCase) ||
508509
string.IsNullOrWhiteSpace(normalizedInput))
509510
return;
510511

@@ -533,7 +534,7 @@ public async Task HandleItemNavigationAsync(string path)
533534
else
534535
{
535536
normalizedInput = StorageFileExtensions.GetResolvedPath(normalizedInput, isFtp);
536-
if (currentPath.Equals(normalizedInput, StringComparison.OrdinalIgnoreCase))
537+
if (currentPath is not null && currentPath.Equals(normalizedInput, StringComparison.OrdinalIgnoreCase))
537538
return;
538539

539540
var item = await FilesystemTasks.Wrap(() => DriveHelpers.GetRootFromPathAsync(normalizedInput));

0 commit comments

Comments
 (0)