diff --git a/application/src/main/java/run/halo/app/notification/endpoint/UserNotificationPreferencesEndpoint.java b/application/src/main/java/run/halo/app/notification/endpoint/UserNotificationPreferencesEndpoint.java index d3d7be08a..8c3757be0 100644 --- a/application/src/main/java/run/halo/app/notification/endpoint/UserNotificationPreferencesEndpoint.java +++ b/application/src/main/java/run/halo/app/notification/endpoint/UserNotificationPreferencesEndpoint.java @@ -174,6 +174,11 @@ public class UserNotificationPreferencesEndpoint implements CustomEndpoint { var notifierNames = reasonTypeNotifierMap.getNotifiers(reasonType.name()); for (String notifierName : notifierNames) { + // Skip if the notifier enabled in the user preference does not + // exist to avoid null index + if (!notifierIndexMap.containsKey(notifierName)) { + continue; + } var notifierIndex = notifierIndexMap.get(notifierName); stateMatrix[reasonTypeIndex][notifierIndex] = true; }