File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
src/Files.App/ViewModels/UserControls Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -942,8 +942,14 @@ public async Task PopulateOmnibarSuggestionsForPathMode()
942942 void AddNoResultsItem ( )
943943 {
944944 PathModeSuggestionItems . Clear ( ) ;
945+
946+ // Use null-safe access to avoid NullReferenceException during app lifecycle transitions
947+ var workingDirectory = string . IsNullOrEmpty ( ContentPageContext . ShellPage ? . ShellViewModel ? . WorkingDirectory )
948+ ? Constants . UserEnvironmentPaths . HomePath
949+ : ContentPageContext . ShellPage . ShellViewModel . WorkingDirectory ;
950+
945951 PathModeSuggestionItems . Add ( new (
946- ContentPageContext . ShellPage . ShellViewModel . WorkingDirectory ,
952+ workingDirectory ,
947953 Strings . NavigationToolbarVisiblePathNoResults . GetLocalizedResource ( ) ) ) ;
948954 }
949955 }
You can’t perform that action at this time.
0 commit comments