Added validation for empty messages.