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

cr: @antonbk @mouli-bluekai 
Why did you remove this line?

Without it the rest of the method implementation does not make sense.