diff options
author | Shawn Castrianni <shawn@spcware.com> | 2016-05-24 13:48:09 -0500 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2016-05-24 11:48:09 -0700 |
commit | ae8bf9d41cb7f3c2e0ce04149c2f3e1108e7c632 (patch) | |
tree | 0469d013ac05cd6f99d856a3e24ba4b697eeb773 | |
parent | fed153aa51336605591b9251396487b9114b6365 (diff) | |
download | xamarin-forms-ae8bf9d41cb7f3c2e0ce04149c2f3e1108e7c632.tar.gz xamarin-forms-ae8bf9d41cb7f3c2e0ce04149c2f3e1108e7c632.tar.bz2 xamarin-forms-ae8bf9d41cb7f3c2e0ce04149c2f3e1108e7c632.zip |
Protect against null Control (#171)
-rw-r--r-- | Xamarin.Forms.Platform.Android/ViewRenderer.cs | 3 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.iOS/ViewRenderer.cs | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.Android/ViewRenderer.cs b/Xamarin.Forms.Platform.Android/ViewRenderer.cs index 143e6a7f..160c3828 100644 --- a/Xamarin.Forms.Platform.Android/ViewRenderer.cs +++ b/Xamarin.Forms.Platform.Android/ViewRenderer.cs @@ -59,6 +59,9 @@ namespace Xamarin.Forms.Platform.Android public override SizeRequest GetDesiredSize(int widthConstraint, int heightConstraint) { + if (Control == null) + return (base.GetDesiredSize(widthConstraint, heightConstraint)); + AView view = _container == this ? (AView)Control : _container; view.Measure(widthConstraint, heightConstraint); diff --git a/Xamarin.Forms.Platform.iOS/ViewRenderer.cs b/Xamarin.Forms.Platform.iOS/ViewRenderer.cs index 1186fb4c..0c0f8f93 100644 --- a/Xamarin.Forms.Platform.iOS/ViewRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/ViewRenderer.cs @@ -38,6 +38,9 @@ namespace Xamarin.Forms.Platform.iOS public override SizeF SizeThatFits(SizeF size) { + if (Control == null) + return (base.SizeThatFits(size)); + return Control.SizeThatFits(size); } |