Adding a null check to avoid NPE during send data call.

cr: @antonbk @mouli-bluekai