Added check to make sure message is not NULL before processing it.