From: David ‘Bombe’ Roden Date: Wed, 13 Oct 2010 13:25:51 +0000 (+0200) Subject: Remove Sone ID from session if the Sone is null. X-Git-Tag: 0.1-RC1~474 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=be893c81154fc559faa094d5440941db33d293e6 Remove Sone ID from session if the Sone is null. --- diff --git a/src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java b/src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java index 4078585..49bd26d 100644 --- a/src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java +++ b/src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java @@ -129,7 +129,11 @@ public class SoneTemplatePage extends TemplatePage { */ protected void setCurrentSone(ToadletContext toadletContext, Sone sone) { Session session = getCurrentSession(toadletContext); - session.setAttribute("Sone.CurrentSone", sone.getId()); + if (sone == null) { + session.removeAttribute("Sone.CurrentSone"); + } else { + session.setAttribute("Sone.CurrentSone", sone.getId()); + } } //