Skip to content

Commit

Permalink
Use Max() instead of conditional statement
Browse files Browse the repository at this point in the history
Suggested in code review, see !599

Co-authored-by: Andrii Chebukin <[email protected]>
  • Loading branch information
pcfist and xperiandri committed Dec 10, 2024
1 parent 8fd5751 commit 65d4c84
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions components/DataTable/src/DataTable/DataTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ protected override Size MeasureOverride(Size availableSize)

// Avoid negative values when columns don't fit `availableSize`. Otherwise the `Size` constructor will throw.
double width = availableSize.Width - fixedWidth - autoSized;
if (width < 0)
width = 0;
width = Math.Max(width, 0);
column.Measure(new Size(width, availableSize.Height));

// Keep track of already 'allotted' space, use either the maximum child size (if we know it) or the header content
Expand Down

0 comments on commit 65d4c84

Please sign in to comment.