Skip to content

Commit 00ee13a

Browse files
authored
Fix: Fixed null ref warnings in BaseShellPage (#13973)
1 parent 713a665 commit 00ee13a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/Files.App/Views/Shells/BaseShellPage.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4-
using Files.App.UserControls.TabBar;
5-
using Files.Core.Data.Enums;
64
using Microsoft.UI.Input;
75
using Microsoft.UI.Xaml;
86
using Microsoft.UI.Xaml.Controls;
@@ -613,8 +611,8 @@ protected void FilesystemViewModel_ItemLoadStatusChanged(object sender, ItemLoad
613611
var columnCanNavigateForward = false;
614612
if (SlimContentPage is ColumnViewBrowser browser)
615613
{
616-
columnCanNavigateBackward = browser.ParentShellPageInstance.CanNavigateBackward;
617-
columnCanNavigateForward = browser.ParentShellPageInstance.CanNavigateForward;
614+
columnCanNavigateBackward = browser.ParentShellPageInstance?.CanNavigateBackward ?? false;
615+
columnCanNavigateForward = browser.ParentShellPageInstance?.CanNavigateForward ?? false;
618616
}
619617
ToolbarViewModel.CanGoBack = ItemDisplay.CanGoBack || columnCanNavigateBackward;
620618
ToolbarViewModel.CanGoForward = ItemDisplay.CanGoForward || columnCanNavigateForward;
@@ -731,7 +729,8 @@ protected static ContentDialog SetContentDialogRoot(ContentDialog contentDialog)
731729
private void HandleBackForwardRequest(PageStackEntry pageContent)
732730
{
733731
var incomingPageNavPath = pageContent.Parameter as NavigationArguments;
734-
incomingPageNavPath.IsLayoutSwitch = false;
732+
if (incomingPageNavPath is not null)
733+
incomingPageNavPath.IsLayoutSwitch = false;
735734

736735
// Update layout type
737736
if (pageContent.SourcePageType != typeof(HomePage))

0 commit comments

Comments
 (0)