Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit 536ea6e

Browse files
authored
If the element's renderer has already been nulled or disposed, request zero space for it (#12114)
fixes #10801
1 parent 54a1679 commit 536ea6e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Xamarin.Forms.Platform.Android/Platform.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1335,9 +1335,13 @@ public static SizeRequest GetNativeSize(VisualElement view, double widthConstrai
13351335
{
13361336
Performance.Start(out string reference);
13371337

1338-
// FIXME: potential crash
13391338
IVisualElementRenderer visualElementRenderer = GetRenderer(view);
13401339

1340+
if (visualElementRenderer == null || visualElementRenderer.View.IsDisposed())
1341+
{
1342+
return new SizeRequest(Size.Zero, Size.Zero);
1343+
}
1344+
13411345
var context = visualElementRenderer.View.Context;
13421346

13431347
// negative numbers have special meanings to android they don't to us

0 commit comments

Comments
 (0)