From 1f4970c0d20b606478ad826e9285f20ea51d3a26 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 6d369d9b5..437ad1900 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeFragment.java @@ -337,7 +337,7 @@ public class HomeFragment extends AppKitFragment implements OnBackPressedListene AccountSession session = AccountSessionManager.getInstance().getAccount(accountID); Instance instance = AccountSessionManager.getInstance().getInstanceInfo(session.domain); - 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) {