Commit 0f0796d2 authored by Guus der Kinderen's avatar Guus der Kinderen Committed by akrherz

OF-1321: Proper null-check to avoid stacktrace with stale session.

parent 436643cb
......@@ -144,7 +144,19 @@ public class WebManager extends WebBean {
public User getUser() {
User pageUser = null;
try {
pageUser = getUserManager().getUser(getAuthToken().getUsername());
final AuthToken authToken = getAuthToken();
if (authToken == null )
{
Log.debug( "Unable to get user: no auth token on session." );
return null;
}
final String username = authToken.getUsername();
if (username == null || username.isEmpty())
{
Log.debug( "Unable to get user: no username in auth token on session." );
return null;
}
pageUser = getUserManager().getUser(username);
}
catch (Exception ex) {
Log.debug("Unexpected exception (which is ignored) while trying to obtain user.", ex);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment