Skip to content

Commit

Permalink
Merge pull request unoplatform#15361 from unoplatform/dev/jela/scroll…
Browse files Browse the repository at this point in the history
…viewer-crash

fix: [iOS] Avoid crash when content size is negative
  • Loading branch information
jeromelaban authored Feb 6, 2024
2 parents 3c188c0 + c7c0acb commit 39f98dd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ public override void LayoutSubviews()
_content.Frame = new CGRect(
GetAdjustedArrangeX(iFwElt, adjustedMeasure, (nfloat)contentMargin.Horizontal()),
GetAdjustedArrangeY(iFwElt, adjustedMeasure, (nfloat)contentMargin.Vertical()),
adjustedMeasure.Width,
adjustedMeasure.Height
Math.Max(0, adjustedMeasure.Width),
Math.Max(0, adjustedMeasure.Height)
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Uno.UI/UI/Xaml/UIElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -934,8 +934,8 @@ public Size RenderSize
get => Visibility == Visibility.Collapsed ? new Size() : _size;
internal set
{
global::System.Diagnostics.Debug.Assert(value.Width >= 0, "Invalid width");
global::System.Diagnostics.Debug.Assert(value.Height >= 0, "Invalid height");
global::System.Diagnostics.Debug.Assert(value.Width >= 0, $"Invalid width ({value.Width})");
global::System.Diagnostics.Debug.Assert(value.Height >= 0, $"Invalid height ({value.Height})");
var previousSize = _size;
_size = value;
if (_size != previousSize)
Expand Down

0 comments on commit 39f98dd

Please sign in to comment.