Avoids null pointer
This commit is contained in:
parent
c31791ea80
commit
99ef945be2
|
@ -247,7 +247,7 @@ public class NotificationsSyncJob extends Job implements OnRetrieveNotifications
|
||||||
super.onLoadingComplete(imageUri, view, loadedImage);
|
super.onLoadingComplete(imageUri, view, loadedImage);
|
||||||
notify_user(getContext(), intent, notificationId, loadedImage, finalTitle, message);
|
notify_user(getContext(), intent, notificationId, loadedImage, finalTitle, message);
|
||||||
String lastNotif = sharedpreferences.getString(Helper.LAST_NOTIFICATION_MAX_ID + userId, null);
|
String lastNotif = sharedpreferences.getString(Helper.LAST_NOTIFICATION_MAX_ID + userId, null);
|
||||||
if( Long.parseLong(notifications.get(0).getId()) > Long.parseLong(lastNotif)){
|
if( lastNotif == null || Long.parseLong(notifications.get(0).getId()) > Long.parseLong(lastNotif)){
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
editor.putString(Helper.LAST_NOTIFICATION_MAX_ID + userId, notifications.get(0).getId());
|
editor.putString(Helper.LAST_NOTIFICATION_MAX_ID + userId, notifications.get(0).getId());
|
||||||
editor.apply();
|
editor.apply();
|
||||||
|
@ -258,7 +258,7 @@ public class NotificationsSyncJob extends Job implements OnRetrieveNotifications
|
||||||
notify_user(getContext(), intent, notificationId, BitmapFactory.decodeResource(getContext().getResources(),
|
notify_user(getContext(), intent, notificationId, BitmapFactory.decodeResource(getContext().getResources(),
|
||||||
R.drawable.mastodonlogo), finalTitle, message);
|
R.drawable.mastodonlogo), finalTitle, message);
|
||||||
String lastNotif = sharedpreferences.getString(Helper.LAST_NOTIFICATION_MAX_ID + userId, null);
|
String lastNotif = sharedpreferences.getString(Helper.LAST_NOTIFICATION_MAX_ID + userId, null);
|
||||||
if( Long.parseLong(notifications.get(0).getId()) > Long.parseLong(lastNotif)){
|
if( lastNotif == null || Long.parseLong(notifications.get(0).getId()) > Long.parseLong(lastNotif)){
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
editor.putString(Helper.LAST_NOTIFICATION_MAX_ID + userId, notifications.get(0).getId());
|
editor.putString(Helper.LAST_NOTIFICATION_MAX_ID + userId, notifications.get(0).getId());
|
||||||
editor.apply();
|
editor.apply();
|
||||||
|
|
Loading…
Reference in New Issue