ln_ws_process_message函数优化,添加条件判断,避免死机
authorluozheng <1732036298@qq.com>
Mon, 27 Oct 2025 11:18:51 +0000 (19:18 +0800)
committerluozheng <1732036298@qq.com>
Mon, 27 Oct 2025 11:18:51 +0000 (19:18 +0800)
code/sdk/zhihui/leiniao/imsl_ln/ln_api.c

index 07af5d3..4c79a06 100644 (file)
@@ -862,12 +862,17 @@ void ln_ws_process_message(const ws_data_msg_t *data_msg, ws_command_t type)
     // }
 
     const char *json_str = NULL;
-    if(data_msg->raw_json)
+    const char *message_id = NULL;
+    const char *cmd_str = NULL;
+    if(data_msg)
     {
-        json_str = data_msg->raw_json;
+        if(data_msg->raw_json)
+        {
+            json_str = data_msg->raw_json;
+        }
+        message_id = data_msg->message_id;
+        cmd_str = data_msg->command_str;
     }
-    const char *message_id = data_msg->message_id;
-    const char *cmd_str = data_msg->command_str;
 
     // printf("[WS] cmd=%d message_id=%s cmd_str=%s\n", (int)type, message_id ? message_id : "", cmd_str ? cmd_str : "");