[bugfix] Avoid NPE when getting the real user identity in an XQuery
Module.

Fixes #388 and fixes #252
Merge pull request #424 from adamretter/feature/bugfix-sm-npe

[bugfix] Avoid NPE when getting the real user identity in an XQuery Module