Fix NPE if user is null

Commit a35f8a20ab623bcd07beac7840889e954438777e replaced the pattern
  user instanceof IdentifiedUser
with
  user.isIdentifiedUser()
.

This results in a NullPointerException in case the user is null
('user instanceof IdentifiedUser' was returning false in this case).
Add a check that the user is not null in all places where the user can
be null.

Change-Id: I71f5933d9a4eb2de6cd7acf616c347bf8a5bd9f2
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
4 files changed