From 29adbde03b8499f070218181500e5774c301328e Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期四, 19 六月 2025 16:16:37 +0800
Subject: [PATCH] 1. 补充发送信号读取PLC信号 2. 补充结束发送信号给PLC
---
SourceCode/Bond/Servo/CAttributeVector.cpp | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/SourceCode/Bond/Servo/CAttributeVector.cpp b/SourceCode/Bond/Servo/CAttributeVector.cpp
index 733c629..79e1776 100644
--- a/SourceCode/Bond/Servo/CAttributeVector.cpp
+++ b/SourceCode/Bond/Servo/CAttributeVector.cpp
@@ -19,9 +19,18 @@
void CAttributeVector::addAttribute(CAttribute* pAttribute, BOOL bReplace/* = FALSE*/)
{
+ if (!pAttribute) {
+ return;
+ }
+
+ const std::string& name = pAttribute->getName();
+ if (name.empty()) {
+ return;
+ }
+
if (bReplace) {
for (auto it = m_attributes.begin(); it != m_attributes.end(); ) {
- if ((*it)->getName().compare(pAttribute->getName()) == 0) {
+ if (name.compare((*it)->getName()) == 0) {
delete (*it);
it = m_attributes.erase(it);
}
--
Gitblit v1.9.3