Include a nil check when checking for userid in session