Commit 971a23aa authored by Dave Cridland's avatar Dave Cridland Committed by GitHub

Merge pull request #784 from guusdk/OF-1321_Prevent_stacktrace_adminconsole

OF-1321: Proper null-check to avoid stacktrace with stale session.
parents db179b23 77b25db9
......@@ -140,7 +140,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