Prevent crash during setting NULL to element via interface method (#4179)
authorAndrei Misiukevich <andrei.misiukevich@gmail.com>
Mon, 22 Oct 2018 19:51:42 +0000 (22:51 +0300)
committerStephane Delcroix <stephane@delcroix.org>
Tue, 23 Oct 2018 08:31:48 +0000 (10:31 +0200)
- fixes #4178
- fixes #4146

Xamarin.Forms.Platform.iOS/VisualElementRenderer.cs

index 5d3c2a7..23e0d7d 100644 (file)
@@ -156,9 +156,9 @@ namespace Xamarin.Forms.Platform.MacOS
 
                protected bool TabStop { get; set; } = true;
 
-               protected void UpdateTabStop () => TabStop = Element.IsTabStop;
+               protected void UpdateTabStop () => TabStop = Element?.IsTabStop ?? true;
 
-               protected void UpdateTabIndex () => TabIndex = Element.TabIndex;
+               protected void UpdateTabIndex() => TabIndex = Element?.TabIndex ?? 0;
 
                public NativeView FocusSearch(bool forwardDirection)
                {