summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Android/VisualElementPackager.cs
diff options
context:
space:
mode:
authoradrianknight89 <adrianknight89@outlook.com>2016-11-30 18:29:16 -0600
committerE.Z. Hart <hartez@users.noreply.github.com>2016-11-30 17:29:16 -0700
commit26d5b2b803d77f46bc1dacd716f86bfd23da7eb8 (patch)
tree0afc9119c1f38093de0a73440ca50113ddd8487c /Xamarin.Forms.Platform.Android/VisualElementPackager.cs
parentccef9cbaa45aed957e44864033fffa815b521d6b (diff)
downloadxamarin-forms-26d5b2b803d77f46bc1dacd716f86bfd23da7eb8.tar.gz
xamarin-forms-26d5b2b803d77f46bc1dacd716f86bfd23da7eb8.tar.bz2
xamarin-forms-26d5b2b803d77f46bc1dacd716f86bfd23da7eb8.zip
fix NRE in packager dispose (#561)
Diffstat (limited to 'Xamarin.Forms.Platform.Android/VisualElementPackager.cs')
-rw-r--r--Xamarin.Forms.Platform.Android/VisualElementPackager.cs9
1 files changed, 6 insertions, 3 deletions
diff --git a/Xamarin.Forms.Platform.Android/VisualElementPackager.cs b/Xamarin.Forms.Platform.Android/VisualElementPackager.cs
index 891d4383..0ad1b424 100644
--- a/Xamarin.Forms.Platform.Android/VisualElementPackager.cs
+++ b/Xamarin.Forms.Platform.Android/VisualElementPackager.cs
@@ -52,10 +52,13 @@ namespace Xamarin.Forms.Platform.Android
_childViews = null;
}
- _renderer.Element.ChildAdded -= _childAddedHandler;
- _renderer.Element.ChildRemoved -= _childRemovedHandler;
+ if (_renderer.Element != null)
+ {
+ _renderer.Element.ChildAdded -= _childAddedHandler;
+ _renderer.Element.ChildRemoved -= _childRemovedHandler;
- _renderer.Element.ChildrenReordered -= _childReorderedHandler;
+ _renderer.Element.ChildrenReordered -= _childReorderedHandler;
+ }
_renderer = null;
}
}