Fixes NPE in formatMessage method when the message is null.