From 7057ef3d5b636e8196969a3b0e4013b4dcdfc9de Mon Sep 17 00:00:00 2001 From: reiyawea Date: Sat, 8 Mar 2025 18:37:26 +0800 Subject: [PATCH] Update holiday.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ArduinoJson 7.3 开始,MemberProxy 和 ElementProxy 变更为non-copyable,所以doc["code"]必须先显式转换到int再做判断。 --- src/holiday.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/holiday.cpp b/src/holiday.cpp index cd16152..864e5d9 100644 --- a/src/holiday.cpp +++ b/src/holiday.cpp @@ -35,8 +35,7 @@ bool getHolidays(Holiday& result, int year, int month) { } http.end(); - int status = doc["code"]; - if (doc["code"] != 0) { + if (int status = doc["code"]) { Serial.println("Get holidays error."); return false; } @@ -59,4 +58,4 @@ bool getHolidays(Holiday& result, int year, int month) { Serial.println(); result.length = i; return true; -} \ No newline at end of file +}