From c705013df8f9efc9b30228d461646e89c123ad5c Mon Sep 17 00:00:00 2001 From: zhanglianghy Date: Thu, 18 Jul 2019 11:04:11 +0800 Subject: [PATCH] =?UTF-8?q?MOD=20aaa-12=20=E8=A7=A3=E5=86=B3json=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2=E6=88=90=E7=BB=93=E6=9E=84=E4=BD=93=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=EF=BC=8C=E5=AD=97=E7=AC=A6=E4=B8=B2=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E8=B6=8A=E7=95=8C=E7=9A=84=E9=97=AE=E9=A2=98=20SOL=20=20?= =?UTF-8?q?=E8=A7=A3=E5=86=B3json=E8=BD=AC=E6=8D=A2=E6=88=90=E7=BB=93?= =?UTF-8?q?=E6=9E=84=E4=BD=93=E7=9A=84=E6=97=B6=E5=80=99=EF=BC=8C=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E4=B8=B2=E5=8F=AF=E8=83=BD=E8=B6=8A=E7=95=8C=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20=E4=BF=AE=E6=94=B9=E4=BA=BA=EF=BC=9Azhangl?= =?UTF-8?q?iang=20=E6=A3=80=E8=A7=86=E4=BA=BA=EF=BC=9Azhangliang?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Common/s2j/s2jdef.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Common/s2j/s2jdef.h b/Common/s2j/s2jdef.h index 7e15737e7..9002b088e 100644 --- a/Common/s2j/s2jdef.h +++ b/Common/s2j/s2jdef.h @@ -52,7 +52,8 @@ typedef struct { #define S2J_STRUCT_GET_STRING_ELEMENT_N(to_struct, from_json, _element, n) \ json_temp = cJSON_GetObjectItem(from_json, #_element); \ - if (json_temp && n > 1) strncpy((to_struct)->_element, json_temp->valuestring, n-1); + if (json_temp && json_temp->valuestring && n > 1)\ + strncpy((to_struct)->_element, json_temp->valuestring, n-1); #define S2J_STRUCT_GET_double_ELEMENT(to_struct, from_json, _element) \ json_temp = cJSON_GetObjectItem(from_json, #_element); \