Fix client crash due to sending invalid chat messages

Signed-off-by: Ross Allan <rallanpcl@gmail.com>