Skip to content

Commit c7687ab

Browse files
Fix: Prevent exception when setting SelectedTabIndex before MainPage is loaded (#17388)
1 parent c51ccf3 commit c7687ab

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/Files.App/Data/Models/AppModel.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,8 @@ public int TabStripSelectedIndex
4242
{
4343
if (value >= 0 && value < MainPageViewModel.AppInstances.Count)
4444
{
45-
var rootFrame = (Frame)MainWindow.Instance.Content;
46-
if (rootFrame.Content is MainPage mainView)
47-
{
45+
if (MainWindow.Instance.Content is Frame rootFrame && rootFrame.Content is MainPage mainView)
4846
mainView.ViewModel.SelectedTabItem = MainPageViewModel.AppInstances[value];
49-
}
5047
}
5148
}
5249
catch (COMException)

0 commit comments

Comments
 (0)