Skip to content

Commit d065d23

Browse files
Fix: Prevent null reference exception when hiding LayoutFlyout (#17546)
Co-authored-by: seer-by-sentry[bot] <157164994+seer-by-sentry[bot]@users.noreply.github.com>
1 parent f6f3297 commit d065d23

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Files.App/UserControls/Toolbar.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ private void AppBarButton_AccessKeyInvoked(UIElement sender, AccessKeyInvokedEve
112112
private void LayoutButton_Click(object sender, RoutedEventArgs e)
113113
{
114114
// Hide flyout after choosing a layout
115-
LayoutFlyout.Hide();
115+
// Check if LayoutFlyout is not null to handle cases where UI elements are unloaded via x:Load
116+
LayoutFlyout?.Hide();
116117
}
117118
}
118119
}

0 commit comments

Comments
 (0)