Skip to content

Commit 57c029e

Browse files
authored
Code Quality: Added null check to UIHelpers.CloseAllDialogs (#16059)
1 parent a80d7bf commit 57c029e

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/Files.App (Package)/Package.appxmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<Identity
1717
Name="FilesDev"
1818
Publisher="CN=Files"
19-
Version="3.6.2.0" />
19+
Version="3.6.3.0" />
2020

2121
<Properties>
2222
<DisplayName>Files - Dev</DisplayName>

src/Files.App/Helpers/UI/UIHelpers.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,14 @@ private static ContentDialog SetContentDialogRoot(ContentDialog contentDialog)
9292

9393
public static void CloseAllDialogs()
9494
{
95+
if (MainWindow.Instance?.Content?.XamlRoot == null)
96+
return;
97+
9598
var openedDialogs = VisualTreeHelper.GetOpenPopupsForXamlRoot(MainWindow.Instance.Content.XamlRoot);
9699

97100
foreach (var item in openedDialogs)
98-
{
99101
if (item.Child is ContentDialog dialog)
100-
{
101102
dialog.Hide();
102-
}
103-
}
104103
}
105104

106105
private static IEnumerable<IconFileInfo> SidebarIconResources = LoadSidebarIconResources();

0 commit comments

Comments
 (0)