path: root/Xamarin.Forms.Platform.Android/CellAdapter.cs
diff options
authorPaul DiPietro <>2016-08-02 16:15:35 (GMT)
committerSamantha Houts <>2016-08-02 16:15:35 (GMT)
commitac44cf9dec53b3b8be1836f20479f01820f3667f (patch)
tree3b5ebf0580020e3ef5fc4d73d51e87c50f608719 /Xamarin.Forms.Platform.Android/CellAdapter.cs
parentea01c07aa32e39e947104253a44566dded50123e (diff)
[Android] Add null check to prevent crashes when long clicking a text entry in ListView header/footer (#271)
When a text entry control (Entry, Editor, SearchBar, etc.) was being used in the header or footer of a ListView on Android, a long click/press would cause a crash. This was occurring in the HandleContextMode method because it expected to be a cell. Adding a null check and breaking out of the method if the value from GetCellForPosition is null prevents this crash from occurring.
Diffstat (limited to 'Xamarin.Forms.Platform.Android/CellAdapter.cs')
1 files changed, 3 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.Android/CellAdapter.cs b/Xamarin.Forms.Platform.Android/CellAdapter.cs
index 4c8ac10..d79df76 100644
--- a/Xamarin.Forms.Platform.Android/CellAdapter.cs
+++ b/Xamarin.Forms.Platform.Android/CellAdapter.cs
@@ -211,6 +211,9 @@ namespace Xamarin.Forms.Platform.Android
Cell cell = GetCellForPosition(position);
+ if (cell == null)
+ return false;
if (_actionMode != null || _supportActionMode != null)
if (!cell.HasContextActions)