Skip to content

Conversation

MohammadSamiIslam
Copy link

Resolved / Related Issues

To prevent extra work, all changes to the Files codebase must link to an approved issue marked as Ready to build. Please insert the issue number following the hashtag with the issue number that this Pull Request resolves.

  • Closes #

Steps used to test these changes

Stability is a top priority for Files and all changes are required to go through testing before being merged into the repo. Please include a list of steps that you used to test this PR.

  1. Opened Files ...
  2. ...

@MohammadSamiIslam
Copy link
Author

This PR Prevents throwing a NullReferenceException when context or context.Childrenis null, there's no null checking.
Maintains the original layout logic while adding safety checks for edge cases

Copy link
Member

@0x5bfa 0x5bfa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While there are some redundant changes made in this file, overall LGTM.
We should keep the look of the code smilar to what MUXC.BreadcrumbBar contrl has.

Comment on lines +34 to +37
if (context?.Children == null || context.Children.Count == 0)
{
return new Size(0, 0);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (context?.Children == null || context.Children.Count == 0)
{
return new Size(0, 0);
}
if (context?.Children is null || context.Children.Count is 0)
return new Size(0, 0);

_availableSize = availableSize;

var indexAfterEllipsis = GetFirstIndexToRender(context);
var maxHeight = 0;
var totalWidth = 0;
var children = context.Children;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caching like this is redundant.


return accumulatedSize;
return new Size(totalWidth, maxHeight);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you don't use Size instead, like I did? And I feel like the code changes in the middle are unnecessary, is there a reason why you change there?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants