From 9f0747e902bbb61229aa46a6bcf802921ee6fb58 Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期六, 21 六月 2025 14:35:33 +0800
Subject: [PATCH] 1. 主窗口添加端口设置按钮,弹出本地测试的端口配置界面
---
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