Fix for null pointer exception when logging errors with a null message