From 2e5bfa1d9cb3c196b612f104dc8447f18fe0c200 Mon Sep 17 00:00:00 2001 From: LucasGGamerM Date: Sat, 8 Apr 2023 15:53:40 -0300 Subject: [PATCH] fix: NPE when instance is null and attempts to get new notifications For some weird reason, someone saw a pixelfed instance return null as the instance, causing a crash on the updateNotificationsBadge method. This reminds me of why java is such a shit language --- .../java/org/joinmastodon/android/fragments/HomeFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeFragment.java index d4db400ef..ee69fe96f 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeFragment.java @@ -291,7 +291,7 @@ public class HomeFragment extends AppKitFragment implements OnBackPressedListene Instance instance = AccountSessionManager.getInstance().getInstanceInfo(session.domain); if (instance == null) return; - new GetNotifications(null, 1, EnumSet.allOf(Notification.Type.class), instance.pleroma != null) + new GetNotifications(null, 1, EnumSet.allOf(Notification.Type.class), instance != null && instance.pleroma != null) .setCallback(new Callback<>() { @Override public void onSuccess(List notifications) {