From: David ‘Bombe’ Roden Date: Tue, 19 Oct 2010 14:39:43 +0000 (+0200) Subject: Don’t crash when not logged in. X-Git-Tag: 0.1-RC1~194 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=181af5c8af499a60095f46748d6f0a40c40f88db;p=Sone.git Don’t crash when not logged in. --- diff --git a/src/main/java/net/pterodactylus/sone/template/SoneAccessor.java b/src/main/java/net/pterodactylus/sone/template/SoneAccessor.java index ebf2f82..60e2e9b 100644 --- a/src/main/java/net/pterodactylus/sone/template/SoneAccessor.java +++ b/src/main/java/net/pterodactylus/sone/template/SoneAccessor.java @@ -67,13 +67,13 @@ public class SoneAccessor extends ReflectionAccessor { return getNiceName(sone); } else if (member.equals("friend")) { Sone currentSone = (Sone) dataProvider.getData("currentSone"); - return currentSone.hasFriend(sone) ? true : null; + return (currentSone != null) && currentSone.hasFriend(sone); } else if (member.equals("current")) { Sone currentSone = (Sone) dataProvider.getData("currentSone"); - return currentSone.equals(sone); + return (currentSone != null) && currentSone.equals(sone); } else if (member.equals("blocked")) { Sone currentSone = (Sone) dataProvider.getData("currentSone"); - return currentSone.isSoneBlocked(sone.getId()); + return (currentSone != null) && currentSone.isSoneBlocked(sone.getId()); } else if (member.equals("modified")) { return sone.getModificationCounter() > 0; } else if (member.equals("status")) {