Don’t try to get the status of a non-existing Sone.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 31 Dec 2010 10:22:54 +0000 (11:22 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 31 Dec 2010 10:22:54 +0000 (11:22 +0100)
src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java

index ae3dfc2..015add5 100644 (file)
@@ -63,12 +63,15 @@ public class GetStatusAjaxPage extends JsonPage {
        protected JsonObject createJsonObject(Request request) {
                /* load Sones. */
                boolean loadAllSones = Boolean.parseBoolean(request.getHttpRequest().getParam("loadAllSones", "true"));
-               Set<Sone> sones = new HashSet<Sone>(Collections.singleton(getCurrentSone(request.getToadletContext())));
+               Set<Sone> sones = new HashSet<Sone>(Collections.singleton(getCurrentSone(request.getToadletContext(), false)));
                if (loadAllSones) {
                        sones.addAll(webInterface.getCore().getSones());
                }
                JsonArray jsonSones = new JsonArray();
                for (Sone sone : sones) {
+                       if (sone == null) {
+                               continue;
+                       }
                        JsonObject jsonSone = createJsonSone(sone);
                        jsonSones.add(jsonSone);
                }