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()
246
246
247
247
// Set default values
248
248
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
+ }
250
262
251
263
// Open the secondary pane
252
264
if ( IsMultiPaneAvailable &&
253
265
GeneralSettingsService . AlwaysOpenDualPaneInNewTab )
254
266
AddPane ( ) ;
255
-
256
- MainWindow . Instance . SizeChanged += MainWindow_SizeChanged ;
257
267
}
258
268
259
269
// Public methods
You can’t perform that action at this time.
0 commit comments