From: penglei <1624952103@qq.com> Date: Wed, 4 Sep 2024 02:40:59 +0000 (+0800) Subject: 修复BUG "天气 JSON解析错误 导致系统开机死机" X-Git-Tag: release_V1.2.70_20241020_135402~518^2~18^2~9 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=9dd0b9cc07b23cf0ff4626742853f21835ad604e;p=mirrors%2FFD230.git 修复BUG "天气 JSON解析错误 导致系统开机死机" --- diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c index 429c88922..2a929dac9 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -2161,7 +2161,11 @@ uint8_t parse_jsonCheck_weather(uint8_t *buf,uint8_t *check)//json 格式解析 } printf("开始解析天气 JSON\n"); cJSON *now_cjson = cJSON_GetObjectItem(root, "now"); - + if(now_cjson == NULL) + { + printf("天气 JSON解析错误\n"); + return 0; + } int humidity = cJSON_GetObjectItem(now_cjson, "humidity")->valueint; char * windScale = cJSON_GetObjectItem(now_cjson, "windScale")->valuestring; char *textNight = cJSON_GetObjectItem(now_cjson, "textNight")->valuestring;