Skip to content

Commit

Permalink
fix(grid): prevent a NullRef Exception when .Arrange() is called befo…
Browse files Browse the repository at this point in the history
…re .Measure()
  • Loading branch information
carldebilly committed May 5, 2021
1 parent ccff7f9 commit 1eea149
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Uno.UI/UI/Xaml/Controls/Grid/Grid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1315,10 +1315,12 @@ protected override XSIZEF MeasureOverride(XSIZEF availableSize)
//------------------------------------------------------------------------
protected override XSIZEF ArrangeOverride(XSIZEF finalSize)
{
if (m_pRows == null || m_pColumns == null)
// UNO NRE FIX
if (HasGridFlags(GridFlags.DefinitionsChanged))
{
// Should call .Measure() first!
return default;
// A call to .Measure() is required before arranging children
// When the DefinitionsChanged is set, the measure is already invalidated
return default; // Returning (0, 0)
}

// Locking the row and columns definitions to prevent changes by user code
Expand Down

0 comments on commit 1eea149

Please sign in to comment.