Fix for NullReferenceException

If relying party is missing it is still used for logging, but I changed
it to use the Realm from message instead.