From 32a29f8517f9747869d1c33c8835b7d749f6d980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BF=B1=20=E6=B2=88?= <2401809606@qq.com> Date: Tue, 30 Dec 2025 00:24:15 +0800 Subject: [PATCH] =?UTF-8?q?cjson=E8=A7=A3=E6=9E=90=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- applications/data/DATA_comm.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/applications/data/DATA_comm.c b/applications/data/DATA_comm.c index f8e5e0d..9ff8831 100644 --- a/applications/data/DATA_comm.c +++ b/applications/data/DATA_comm.c @@ -103,16 +103,17 @@ void pasre_DAT(const char *api, const char *json_str) json_buffer=NULL; } - if(strlen(json_str)>4) + if(strlen(json_str)>10) { - cjson_falg=1; + cjson_falg=1; //判断json解析是否成功 - if(!root) - { - rt_kprintf("JSON parse error :%s\n",cJSON_GetErrorPtr()); - cJSON_Delete(root); - // return "JSON parse error\n"; - } + if(!root) + { + rt_kprintf("JSON parse error :%s\n",cJSON_GetErrorPtr()); + cJSON_Delete(root); + cJSON_Delete(dat); + return; + } } if (strcmp(api, "SC800") == 0)