From dd69819f38c2cb9afa39b341e039fae223e0f921 Mon Sep 17 00:00:00 2001 From: admar Date: Mon, 16 May 2022 22:07:27 +0200 Subject: [PATCH] Fix bug in parsing AQI_max / pollen_max --- Claire.ino | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Claire.ino b/Claire.ino index 4edc701..4243414 100644 --- a/Claire.ino +++ b/Claire.ino @@ -173,11 +173,15 @@ void parseJson(String * payload) n = n + 1; } - rainpickerData.AQI_max.time[0] = doc["AQI_max"]["time"]; - rainpickerData.AQI_max.value[0] = doc["AQI_max"]["value"]; + if (doc.containsKey("AQI_max")) { + rainpickerData.AQI_max.time[0] = doc["AQI_max"]["time"]; + rainpickerData.AQI_max.value[0] = doc["AQI_max"]["value"]; + } - rainpickerData.pollen_max.time[0] = doc["pollen"]["time"]; - rainpickerData.pollen_max.value[0] = doc["pollen"]["value"]; + if (doc.containsKey("pollen_max")) { + rainpickerData.pollen_max.time[0] = doc["pollen_max"]["time"]; + rainpickerData.pollen_max.value[0] = doc["pollen_max"]["value"]; + } n = 0; for (JsonObject elem : doc["UVI"].as()) {