From 5a83cb1c48e56bf4017271e046c38c468b4a1cff Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Sat, 31 Dec 2016 19:29:41 +0100 Subject: [PATCH] Pebble: fix npe in mario time handler I shout stop for 2016! :D --- .../service/devices/pebble/AppMessageHandlerMarioTime.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerMarioTime.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerMarioTime.java index be4e9a97b..46992628c 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerMarioTime.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerMarioTime.java @@ -26,6 +26,10 @@ class AppMessageHandlerMarioTime extends AppMessageHandler { } private byte[] encodeMarioWeatherMessage(WeatherSpec weatherSpec) { + if (weatherSpec == null) { + return null; + } + ArrayList> pairs = new ArrayList<>(2); pairs.add(new Pair<>(KEY_WEATHER_ICON_ID, (Object) (byte) 1)); pairs.add(new Pair<>(KEY_WEATHER_TEMPERATURE, (Object) (byte) (weatherSpec.currentTemp - 273)));