Fix #647

I'm unsure how we are getting null objects in the queue for #647, but next_message.length is the one probably throwing the error (because null's don't have a length, unlike byte[0]).