X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FTrustAjaxPage.java;fp=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FTrustAjaxPage.java;h=d6e2750a79aac0e88d26f24d533b167dec10d39f;hb=2e50c68bc1f7c92efccbb212bc62fc3c1e07402f;hp=e298a50a6387c6d0ac68530efd46666ab07ce793;hpb=14d84b8dcb4005b84ff8b26231c6941827243f4f;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/TrustAjaxPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/TrustAjaxPage.java index e298a50..d6e2750 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/TrustAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/TrustAjaxPage.java @@ -19,6 +19,7 @@ package net.pterodactylus.sone.web.ajax; import net.pterodactylus.sone.core.Core; import net.pterodactylus.sone.data.Sone; +import net.pterodactylus.sone.freenet.wot.Trust; import net.pterodactylus.sone.web.WebInterface; import net.pterodactylus.util.json.JsonObject; @@ -55,7 +56,11 @@ public class TrustAjaxPage extends JsonPage { return createErrorJsonObject("invalid-sone-id"); } webInterface.getCore().trustSone(currentSone, sone); - return createSuccessJsonObject().put("trustValue", webInterface.getCore().getTrust(currentSone, sone).getExplicit()); + Trust trust = webInterface.getCore().getTrust(currentSone, sone); + if (trust == null) { + return createErrorJsonObject("wot-plugin"); + } + return createSuccessJsonObject().put("trustValue", trust.getExplicit()); } }