diff --git a/app/src/main/java/net/pokeranalytics/android/ui/view/ContextMenuRecyclerView.kt b/app/src/main/java/net/pokeranalytics/android/ui/view/ContextMenuRecyclerView.kt index f64fda66..a473357d 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/view/ContextMenuRecyclerView.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/view/ContextMenuRecyclerView.kt @@ -20,9 +20,11 @@ class ContextMenuRecyclerView : RecyclerView { } override fun showContextMenuForChild(originalView: View): Boolean { + val longPressPosition = getChildAdapterPosition(originalView) - if (longPressPosition >= 0) { - val longPressId = adapter!!.getItemId(longPressPosition) + val longPressId = adapter?.getItemId(longPressPosition) + + if (longPressPosition >= 0 && longPressId != null) { mContextMenuInfo = RecyclerViewContextMenuInfo(longPressPosition, longPressId) return super.showContextMenuForChild(originalView) }