Skip to content

Commit

Permalink
fix(grid): Removed the possibility of a NullRefException when .Arrang…
Browse files Browse the repository at this point in the history
…e() is called before calling .Measure() first.
  • Loading branch information
carldebilly committed May 5, 2021
1 parent e24219d commit ccff7f9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Uno.UI/UI/Xaml/Controls/Grid/Grid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1315,6 +1315,12 @@ protected override XSIZEF MeasureOverride(XSIZEF availableSize)
//------------------------------------------------------------------------
protected override XSIZEF ArrangeOverride(XSIZEF finalSize)
{
if (m_pRows == null || m_pColumns == null)
{
// Should call .Measure() first!
return default;
}

// Locking the row and columns definitions to prevent changes by user code
// during the arrange pass.
LockDefinitions();
Expand Down

0 comments on commit ccff7f9

Please sign in to comment.