From dab0c560e9bf4aa68debb234a5be0fc93ebe8041 Mon Sep 17 00:00:00 2001 From: sk Date: Mon, 23 Jan 2023 12:23:15 +0100 Subject: [PATCH] fix crash when recycler view is null --- .../main/java/org/joinmastodon/android/fragments/IsOnTop.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/IsOnTop.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/IsOnTop.java index 3b1c999e9..071e44775 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/IsOnTop.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/IsOnTop.java @@ -1,11 +1,13 @@ package org.joinmastodon.android.fragments; +import androidx.annotation.Nullable; import androidx.recyclerview.widget.RecyclerView; public interface IsOnTop { boolean isOnTop(); - default boolean isRecyclerViewOnTop(RecyclerView list) { + default boolean isRecyclerViewOnTop(@Nullable RecyclerView list) { + if (list == null) return true; return !list.canScrollVertically(-1); } }