Skip to content

Code Quality: Prevent exceptions when available size is zero or negative #17477

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/Files.App.Controls/BreadcrumbBar/BreadcrumbBarLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ private int GetFirstIndexToRender(NonVirtualizingLayoutContext context)
var itemCount = context.Children.Count;
var accumulatedWidth = 0d;

// Handle zero or negative available width - hide all items
if (_availableSize.Width <= 0)
return itemCount;

// Go through all items from the last item
for (int index = itemCount - 1; index >= 0; index--)
{
Expand All @@ -111,4 +115,4 @@ private int GetFirstIndexToRender(NonVirtualizingLayoutContext context)
return 0;
}
}
}
}
Loading