gengxin
author@CHENG <2393524978@qq.com>
Thu, 9 May 2024 01:42:34 +0000 (09:42 +0800)
committer@CHENG <2393524978@qq.com>
Thu, 9 May 2024 01:42:34 +0000 (09:42 +0800)
2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_api.c

index 96e22aa..51f4f99 100644 (file)
@@ -313,17 +313,17 @@ void mmi_watch_authenticate_action(void)
                                {
                                        char * bid = cJSON_GetStringValue(cJSON_GetObjectItem(json_data, "bid"));
                                        //PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: bid=%s\n", __FUNCTION__, __LINE__, bid);
-                                       if(NULL != bid)
+                                       if(NULL != bid && 0 != strlen(bid))
                                                mmi_protocol_device_name_set(bid);
 
                                        char * key = cJSON_GetStringValue(cJSON_GetObjectItem(json_data, "secretKey"));
                                        //PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: key=%s\n", __FUNCTION__, __LINE__, key);
-                                       if(NULL != key)
+                                       if(NULL != key && 0 != strlen(key))
                                                mmi_protocol_md5_key_str_set(key);
                                        
                                        char * host = cJSON_GetStringValue(cJSON_GetObjectItem(json_data, "host"));
                                        //PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: host=%s\n", __FUNCTION__, __LINE__, host);
-                                       if(NULL != host)
+                                       if(NULL != host && 0 != strlen(host))
                                                mmi_watch_host_name_set(host);
                                        
                                        int port = cJSON_GetIntValue(cJSON_GetObjectItem(json_data, "port"));
@@ -380,7 +380,7 @@ char * mmi_watch_host_name_get(void)
 
 void mmi_watch_host_name_set(char * ip_address)
 {
-       if(NULL == ip_address)
+       if(NULL == ip_address || 0 == strlen(ip_address))
                return;
        if(NV_WATCH_HOST_NAME_LEN_MIN > strlen(ip_address) || NV_WATCH_HOST_NAME_LEN_MAX <= strlen(ip_address))
                return;