diff options
| -rw-r--r-- | android/app/src/com/android/bluetooth/tbs/TbsGatt.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/android/app/src/com/android/bluetooth/tbs/TbsGatt.java b/android/app/src/com/android/bluetooth/tbs/TbsGatt.java index b46b4640f8..5ad083e58a 100644 --- a/android/app/src/com/android/bluetooth/tbs/TbsGatt.java +++ b/android/app/src/com/android/bluetooth/tbs/TbsGatt.java @@ -596,9 +596,17 @@ public class TbsGatt { if (DBG) { Log.d(TAG, "setIncomingCall: callIndex=" + callIndex + " uri=" + uri); } - byte[] value = new byte[uri.length() + 1]; + int uri_len = 0; + if (uri != null) { + uri_len = uri.length(); + } + + byte[] value = new byte[uri_len + 1]; value[0] = (byte) (callIndex & 0xff); - System.arraycopy(uri.getBytes(), 0, value, 1, uri.length()); + + if (uri_len > 0) { + System.arraycopy(uri.getBytes(), 0, value, 1, uri_len); + } return mIncomingCallCharacteristic.setValue(value); } |
