Remove notification information from “get status” AJAX handler.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / ajax / GetNotificationAjaxPage.java
index 198a04f..6cdbf12 100644 (file)
@@ -21,7 +21,7 @@ import java.io.IOException;
 import java.io.StringWriter;
 
 import net.pterodactylus.sone.data.Post;
-import net.pterodactylus.sone.data.Reply;
+import net.pterodactylus.sone.data.PostReply;
 import net.pterodactylus.sone.data.Sone;
 import net.pterodactylus.sone.main.SonePlugin;
 import net.pterodactylus.sone.notify.ListNotification;
@@ -82,10 +82,14 @@ public class GetNotificationAjaxPage extends JsonPage {
                Sone currentSone = getCurrentSone(request.getToadletContext(), false);
                for (String notificationId : notificationIds) {
                        Notification notification = webInterface.getNotifications().getNotification(notificationId);
+                       if (notification == null) {
+                               // TODO - show error
+                               continue;
+                       }
                        if ("new-post-notification".equals(notificationId)) {
                                notification = ListNotificationFilters.filterNewPostNotification((ListNotification<Post>) notification, currentSone, false);
                        } else if ("new-reply-notification".equals(notificationId)) {
-                               notification = ListNotificationFilters.filterNewReplyNotification((ListNotification<Reply>) notification, currentSone);
+                               notification = ListNotificationFilters.filterNewReplyNotification((ListNotification<PostReply>) notification, currentSone);
                        } else if ("mention-notification".equals(notificationId)) {
                                notification = ListNotificationFilters.filterNewPostNotification((ListNotification<Post>) notification, currentSone, false);
                        }