Pebble: fix potential crash when encoding appmessages with null values

here
Andreas Shimokawa 2017-01-24 11:07:00 +01:00
parent 378d285b1a
commit 8027b8ac96
1 changed files with 2 additions and 0 deletions

View File

@ -1846,6 +1846,8 @@ public class PebbleProtocol extends GBDeviceProtocol {
byte[] encodeApplicationMessagePush(short endpoint, UUID uuid, ArrayList<Pair<Integer, Object>> pairs) {
int length = LENGTH_UUID + 3; // UUID + (PUSH + id + length of dict)
for (Pair<Integer, Object> pair : pairs) {
if (pair.first == null || pair.second == null)
continue;
length += 7; // key + type + length
if (pair.second instanceof Integer) {
length += 4;