Skip to content

Commit

Permalink
Fix random NullPointerException in notification actions preference
Browse files Browse the repository at this point in the history
  • Loading branch information
Stypox committed Mar 28, 2021
1 parent 4a1e2e7 commit c848145
Showing 1 changed file with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,22 @@ private void setupActions(@NonNull final View view) {
////////////////////////////////////////////////////////////////////////////

private void saveChanges() {
final SharedPreferences.Editor editor = getSharedPreferences().edit();
if (compactSlots != null && notificationSlots != null) {
final SharedPreferences.Editor editor = getSharedPreferences().edit();

for (int i = 0; i < 3; i++) {
editor.putInt(getContext().getString(NotificationConstants.SLOT_COMPACT_PREF_KEYS[i]),
(i < compactSlots.size() ? compactSlots.get(i) : -1));
}
for (int i = 0; i < 3; i++) {
editor.putInt(getContext().getString(
NotificationConstants.SLOT_COMPACT_PREF_KEYS[i]),
(i < compactSlots.size() ? compactSlots.get(i) : -1));
}

for (int i = 0; i < 5; i++) {
editor.putInt(getContext().getString(NotificationConstants.SLOT_PREF_KEYS[i]),
notificationSlots[i].selectedAction);
}
for (int i = 0; i < 5; i++) {
editor.putInt(getContext().getString(NotificationConstants.SLOT_PREF_KEYS[i]),
notificationSlots[i].selectedAction);
}

editor.apply();
editor.apply();
}
}


Expand Down

0 comments on commit c848145

Please sign in to comment.