diff options
author | Toni Petrina <tonipetrina@hotmail.com> | 2016-07-19 01:26:59 +0200 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2016-07-18 16:26:59 -0700 |
commit | e36816810fb0c29fd5607e9cbb2102d64c46b23f (patch) | |
tree | 61f8c3882f6ea52d51459be6cca42f8c14e9d4f1 /Xamarin.Forms.Platform.Android | |
parent | d1885b44657bb573f3b2aa00cf5e36ed03c41eaa (diff) | |
download | xamarin-forms-e36816810fb0c29fd5607e9cbb2102d64c46b23f.tar.gz xamarin-forms-e36816810fb0c29fd5607e9cbb2102d64c46b23f.tar.bz2 xamarin-forms-e36816810fb0c29fd5607e9cbb2102d64c46b23f.zip |
[Android] Null reference exception fix (#252)
* Added null checks
* Replaced spaces with tabs
Diffstat (limited to 'Xamarin.Forms.Platform.Android')
-rw-r--r-- | Xamarin.Forms.Platform.Android/Renderers/ListViewRenderer.cs | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/Xamarin.Forms.Platform.Android/Renderers/ListViewRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/ListViewRenderer.cs index 08bc2f50..41758101 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/ListViewRenderer.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/ListViewRenderer.cs @@ -249,7 +249,8 @@ namespace Xamarin.Forms.Platform.Android var footer = (VisualElement)Controller.FooterElement; if (_footerRenderer != null && (footer == null || Registrar.Registered.GetHandlerType(footer.GetType()) != _footerRenderer.GetType())) { - _footerView.Child = null; + if (_footerView != null) + _footerView.Child = null; _footerRenderer.Dispose(); _footerRenderer = null; } @@ -262,7 +263,8 @@ namespace Xamarin.Forms.Platform.Android else { _footerRenderer = Platform.CreateRenderer(footer); - _footerView.Child = _footerRenderer; + if (_footerView != null) + _footerView.Child = _footerRenderer; } Platform.SetRenderer(footer, _footerRenderer); @@ -273,7 +275,8 @@ namespace Xamarin.Forms.Platform.Android var header = (VisualElement)Controller.HeaderElement; if (_headerRenderer != null && (header == null || Registrar.Registered.GetHandlerType(header.GetType()) != _headerRenderer.GetType())) { - _headerView.Child = null; + if (_headerView != null) + _headerView.Child = null; _headerRenderer.Dispose(); _headerRenderer = null; } @@ -286,7 +289,8 @@ namespace Xamarin.Forms.Platform.Android else { _headerRenderer = Platform.CreateRenderer(header); - _headerView.Child = _headerRenderer; + if (_headerView != null) + _headerView.Child = _headerRenderer; } Platform.SetRenderer(header, _headerRenderer); @@ -294,12 +298,14 @@ namespace Xamarin.Forms.Platform.Android void UpdateIsRefreshing() { - _refresh.Refreshing = Element.IsRefreshing; + if (_refresh != null) + _refresh.Refreshing = Element.IsRefreshing; } void UpdateIsSwipeToRefreshEnabled() { - _refresh.Enabled = Element.IsPullToRefreshEnabled && (Element as IListViewController).RefreshAllowed; + if (_refresh != null) + _refresh.Enabled = Element.IsPullToRefreshEnabled && (Element as IListViewController).RefreshAllowed; } internal class Container : ViewGroup @@ -357,4 +363,4 @@ namespace Xamarin.Forms.Platform.Android } } } -}
\ No newline at end of file +} |