summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Maps.iOS
diff options
context:
space:
mode:
authorDamian Karzon <dkarzon@outlook.com>2017-07-04 12:08:58 (GMT)
committerRui Marinho <me@ruimarinho.net>2017-07-04 12:08:58 (GMT)
commit747b01b5bb9b18fc60e2d00a7dffa70d36475e98 (patch)
tree81a96cb0a7edadb88eb1fdf662062390f61e7b57 /Xamarin.Forms.Maps.iOS
parent0f3250cc8a1119d0281994c3320483695fea5f3f (diff)
downloadxamarin-forms-747b01b5bb9b18fc60e2d00a7dffa70d36475e98.zip
xamarin-forms-747b01b5bb9b18fc60e2d00a7dffa70d36475e98.tar.gz
xamarin-forms-747b01b5bb9b18fc60e2d00a7dffa70d36475e98.tar.bz2
[iOS] Fix for disposing a map causing a null reference (#1027)
Diffstat (limited to 'Xamarin.Forms.Maps.iOS')
-rw-r--r--Xamarin.Forms.Maps.iOS/MapRenderer.cs7
1 files changed, 5 insertions, 2 deletions
diff --git a/Xamarin.Forms.Maps.iOS/MapRenderer.cs b/Xamarin.Forms.Maps.iOS/MapRenderer.cs
index 2fac61a..7940a57 100644
--- a/Xamarin.Forms.Maps.iOS/MapRenderer.cs
+++ b/Xamarin.Forms.Maps.iOS/MapRenderer.cs
@@ -198,8 +198,11 @@ namespace Xamarin.Forms.Maps.MacOS
var mkMapView = (MKMapView)Control;
mkMapView.RegionChanged -= MkMapViewOnRegionChanged;
mkMapView.GetViewForAnnotation = null;
- mkMapView.Delegate.Dispose();
- mkMapView.Delegate = null;
+ if (mkMapView.Delegate != null)
+ {
+ mkMapView.Delegate.Dispose();
+ mkMapView.Delegate = null;
+ }
mkMapView.RemoveFromSuperview();
#if __MOBILE__
if (FormsMaps.IsiOs9OrNewer)