mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-25 11:26:47 +01:00
Pebble: fix potential crash when encoding appmessages with null values
This commit is contained in:
parent
378d285b1a
commit
8027b8ac96
@ -1846,6 +1846,8 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
|||||||
byte[] encodeApplicationMessagePush(short endpoint, UUID uuid, ArrayList<Pair<Integer, Object>> pairs) {
|
byte[] encodeApplicationMessagePush(short endpoint, UUID uuid, ArrayList<Pair<Integer, Object>> pairs) {
|
||||||
int length = LENGTH_UUID + 3; // UUID + (PUSH + id + length of dict)
|
int length = LENGTH_UUID + 3; // UUID + (PUSH + id + length of dict)
|
||||||
for (Pair<Integer, Object> pair : pairs) {
|
for (Pair<Integer, Object> pair : pairs) {
|
||||||
|
if (pair.first == null || pair.second == null)
|
||||||
|
continue;
|
||||||
length += 7; // key + type + length
|
length += 7; // key + type + length
|
||||||
if (pair.second instanceof Integer) {
|
if (pair.second instanceof Integer) {
|
||||||
length += 4;
|
length += 4;
|
||||||
|
Loading…
Reference in New Issue
Block a user