Skip to content

Commit c6ad49c

Browse files
authored
Fix: Fixed NullReferenceException in DirectoryInfoUpdated (#14720)
1 parent 27676d4 commit c6ad49c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,16 +270,20 @@ protected async void FilesystemViewModel_DirectoryInfoUpdated(object sender, Eve
270270
}
271271
}
272272

273+
var contentPage = ContentPage;
274+
if (contentPage is null)
275+
return;
276+
273277
if (!GitHelpers.IsExecutingGitAction)
274278
{
275-
ContentPage.DirectoryPropertiesViewModel.UpdateGitInfo(
279+
contentPage.DirectoryPropertiesViewModel.UpdateGitInfo(
276280
InstanceViewModel.IsGitRepository,
277281
InstanceViewModel.GitRepositoryPath,
278282
headBranch);
279283
}
280284

281-
ContentPage.DirectoryPropertiesViewModel.DirectoryItemCount = $"{FilesystemViewModel.FilesAndFolders.Count} {directoryItemCountLocalization}";
282-
ContentPage.UpdateSelectionSize();
285+
contentPage.DirectoryPropertiesViewModel.DirectoryItemCount = $"{FilesystemViewModel.FilesAndFolders.Count} {directoryItemCountLocalization}";
286+
contentPage.UpdateSelectionSize();
283287
}
284288

285289
protected async void FilesystemViewModel_GitDirectoryUpdated(object sender, EventArgs e)

0 commit comments

Comments
 (0)