fix segfault when the devtype is null
This commit is contained in:
@@ -905,11 +905,15 @@ void process_ledger_update(trigger_update_xml_t *ledger_update_xml)
|
||||
char msg[256];
|
||||
snprintf(msg, sizeof(msg), "终端 id: %s 台账更新失败,无法写入台账", update[i].terminal_id);
|
||||
send_reply_to_kafka_c(update[i].guid, "2", msg);
|
||||
|
||||
clearIed(ied);//添加失败清空整个ied
|
||||
|
||||
return ;
|
||||
}
|
||||
//3-写入台账内容///////////////////////////////////
|
||||
|
||||
//4-配置映射文件//////////////////////////////
|
||||
char model[64];
|
||||
char model[64] = {0};
|
||||
// 获取模型ID,检查是否返回 NULL
|
||||
parse_model_cfg_web_one(ied,&model);//存储在/FeProject/dat/
|
||||
|
||||
@@ -923,6 +927,9 @@ void process_ledger_update(trigger_update_xml_t *ledger_update_xml)
|
||||
char msg[256];
|
||||
snprintf(msg, sizeof(msg), "终端 id: %s 台账更新失败,没有找到装置型号", update[i].terminal_id);
|
||||
send_reply_to_kafka_c(update[i].guid, "2", msg);
|
||||
|
||||
clearIed(ied);//添加失败清空整个ied
|
||||
|
||||
return ;
|
||||
}
|
||||
char full_path[128];
|
||||
@@ -1001,6 +1008,9 @@ void process_ledger_update(trigger_update_xml_t *ledger_update_xml)
|
||||
char msg[256];
|
||||
snprintf(msg, sizeof(msg), "终端 id: %s 台账更新失败,台账无法写入", update[i].terminal_id);
|
||||
send_reply_to_kafka_c(update[i].guid, "2", msg);
|
||||
|
||||
clearIed(ied);//添加失败清空整个ied
|
||||
|
||||
return ;
|
||||
}
|
||||
//3-写入台账内容////////////////////////////////////////////
|
||||
@@ -1021,6 +1031,9 @@ void process_ledger_update(trigger_update_xml_t *ledger_update_xml)
|
||||
char msg[256];
|
||||
snprintf(msg, sizeof(msg), "终端 id: %s 台账更新失败,没有找到装置型号", update[i].terminal_id);
|
||||
send_reply_to_kafka_c(update[i].guid, "2", msg);
|
||||
|
||||
clearIed(ied);//添加失败清空整个ied
|
||||
|
||||
return ;
|
||||
}
|
||||
char full_path[128];
|
||||
@@ -1378,8 +1391,16 @@ void CheckAllConnectedChannel()
|
||||
do {
|
||||
chnl_usr = g_pt61850app->chnl_usr[chnl_sequence_no];
|
||||
chnl_sequence_no = (chnl_sequence_no+1) % g_pt61850app->chnl_counts;
|
||||
|
||||
if (chnl_usr == NULL) continue; // 安全防护lnk20250701
|
||||
|
||||
} while ( (g_onlyIP[0]!=0) && (strcmp(g_onlyIP,chnl_usr->ip_str)!=0) );
|
||||
|
||||
if (chnl_usr == NULL || chnl_usr->chnl == NULL || chnl_usr->chnl->ied == NULL || chnl_usr->chnl->ied->usr_ext == NULL) {
|
||||
printf("chnl_usr or nested member is NULL, skip...\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if(chnl_usr->m_state == CHANNEL_CONNECTED)
|
||||
{
|
||||
|
||||
@@ -1427,8 +1448,16 @@ void CheckNextNotConnectedChannel()
|
||||
do {
|
||||
chnl_usr = g_pt61850app->chnl_usr[chnl_total_no];
|
||||
chnl_total_no = (chnl_total_no+1) % g_pt61850app->chnl_counts;
|
||||
|
||||
if (chnl_usr == NULL) continue; // 安全防护lnk20250701
|
||||
|
||||
} while ( (g_onlyIP[0]!=0) && (strcmp(g_onlyIP,chnl_usr->ip_str)!=0) );
|
||||
|
||||
if (chnl_usr == NULL || chnl_usr->chnl == NULL || chnl_usr->chnl->ied == NULL || chnl_usr->chnl->ied->usr_ext == NULL) {
|
||||
printf("chnl_usr or nested member is NULL, skip...\n");
|
||||
return;
|
||||
}
|
||||
|
||||
//终端日志的key,lnk20250526
|
||||
char full_key_t_c[256]; // 分配足够空间
|
||||
char full_key_t_d[256]; // 分配足够空间
|
||||
|
||||
Reference in New Issue
Block a user