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
committed by sk
parent d7b76ed70a
commit 2e5bfa1d9c

View File

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