transport: add a null pointer check.