Fix null data handling in ServiceCommand.writeCommand()

This commit is contained in:
Hung-ying Tyan
2009-07-03 17:38:59 +08:00
parent 4bca97ecaf
commit 116d890aea

View File

@@ -140,7 +140,7 @@ public class ServiceCommand {
private boolean writeCommand(int cmd, String _data) {
byte buf[] = new byte[8];
byte[] data = _data.getBytes();
byte[] data = (_data == null) ? new byte[0] : _data.getBytes();
int len = data.length;
// the length of data
buf[0] = (byte) (len & 0xff);