Skip to content

Commit 924fac3

Browse files
committed
Code Quality: Fix exception when auto sizing columns
1 parent 96c2373 commit 924fac3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Files.App/Views/Layouts/ColumnsLayoutPage.xaml.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ private void ColumnViewBase_ItemInvoked(object? sender, EventArgs e)
8383

8484
public void SetWidth(int index)
8585
{
86-
var blade = ColumnHost.ActiveBlades[index];
86+
var activeBlades = ColumnHost.ActiveBlades;
87+
if (index < 0 || activeBlades is null || index >= activeBlades.Count)
88+
return;
89+
90+
var blade = activeBlades[index];
8791
blade?.SetWidth();
8892
}
8993

0 commit comments

Comments
 (0)