Skip to content

Commit 1e67aa4

Browse files
Code Quality: Prevent exceptions when available size is zero or negative (#17477)
Co-authored-by: seer-by-sentry[bot] <157164994+seer-by-sentry[bot]@users.noreply.github.com> Co-authored-by: Yair <[email protected]>
1 parent 1d81df8 commit 1e67aa4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Files.App.Controls/BreadcrumbBar/BreadcrumbBarLayout.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ private int GetFirstIndexToRender(NonVirtualizingLayoutContext context)
9898
var itemCount = context.Children.Count;
9999
var accumulatedWidth = 0d;
100100

101+
// Handle zero or negative available width - hide all items
102+
if (_availableSize.Width <= 0)
103+
return itemCount;
104+
101105
// Go through all items from the last item
102106
for (int index = itemCount - 1; index >= 0; index--)
103107
{
@@ -111,4 +115,4 @@ private int GetFirstIndexToRender(NonVirtualizingLayoutContext context)
111115
return 0;
112116
}
113117
}
114-
}
118+
}

0 commit comments

Comments
 (0)