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
This commit is contained in:
LucasGGamerM 2023-04-08 15:53:40 -03:00
parent e9833baaa4
commit 1f4970c0d2
1 changed files with 1 additions and 1 deletions

View File

@ -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<Notification> notifications) {