File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -246,14 +246,24 @@ public ShellPanesPage()
246246
247247 // Set default values
248248 ActivePane = GetPane ( 0 ) ;
249- _WindowIsCompact = MainWindow . Instance . Bounds . Width <= Constants . UI . MultiplePaneWidthThreshold ;
249+
250+ try
251+ {
252+ _WindowIsCompact = MainWindow . Instance . Bounds . Width <= Constants . UI . MultiplePaneWidthThreshold ;
253+ MainWindow . Instance . SizeChanged += MainWindow_SizeChanged ;
254+ }
255+ catch ( Exception )
256+ {
257+ // Handle exception in case WinUI Windows is closed
258+ // (see https://github.com/files-community/Files/issues/15599)
259+
260+ _WindowIsCompact = false ;
261+ }
250262
251263 // Open the secondary pane
252264 if ( IsMultiPaneAvailable &&
253265 GeneralSettingsService . AlwaysOpenDualPaneInNewTab )
254266 AddPane ( ) ;
255-
256- MainWindow . Instance . SizeChanged += MainWindow_SizeChanged ;
257267 }
258268
259269 // Public methods
You can’t perform that action at this time.
0 commit comments