Fixing a possible index-out-of-bouds-exception if len(data)==0.
"&data[0]" requires a minimum length of 1 byte.