am c9149984: Merge "Prevent NullPointerException in getStringValue if no value is set" into lmp-mr1-dev
* commit 'c91499842fed63c55326e7e2a71b491f7c9315c1': Prevent NullPointerException in getStringValue if no value is set
This commit is contained in:
@@ -502,7 +502,7 @@ public class BluetoothGattCharacteristic {
|
||||
* @return Cached value of the characteristic
|
||||
*/
|
||||
public String getStringValue(int offset) {
|
||||
if (offset > mValue.length) return null;
|
||||
if (mValue == null || offset > mValue.length) return null;
|
||||
byte[] strBytes = new byte[mValue.length - offset];
|
||||
for (int i=0; i != (mValue.length-offset); ++i) strBytes[i] = mValue[offset+i];
|
||||
return new String(strBytes);
|
||||
|
||||
Reference in New Issue
Block a user