Add check to check if data buffer populated

Check added to only call API if data buffer is populated to prevent null
calls.