1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-25 03:16:51 +01:00

Pebble: fix potential crash when encoding appmessages with null values

This commit is contained in:
Andreas Shimokawa 2017-01-24 11:07:00 +01:00
parent 378d285b1a
commit 8027b8ac96

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;