Remove Sone ID from session if the Sone is null.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 13 Oct 2010 13:25:51 +0000 (15:25 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 13 Oct 2010 13:25:51 +0000 (15:25 +0200)
src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java

index 4078585..49bd26d 100644 (file)
@@ -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());
+               }
        }
 
        //