From 16fa08d2a1b53aa7250f343e513a08e3224863e9 Mon Sep 17 00:00:00 2001 From: Meutel Date: Sat, 29 Jul 2017 19:30:32 +0200 Subject: [PATCH] Photoblog: fix cast nil session value --- photoblog/admin/admin.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/photoblog/admin/admin.go b/photoblog/admin/admin.go index f4e331d..6eeb768 100644 --- a/photoblog/admin/admin.go +++ b/photoblog/admin/admin.go @@ -94,11 +94,8 @@ func (app *AuthCookie) Username(res http.ResponseWriter, req *http.Request) stri if session == nil { return "" } - val := session.Values[SESS_USER] - if val == nil { - return "" - } - return val.(string) + val, _ := session.Values[SESS_USER].(string) + return val } // Current session