修复 XEquipment 参数 getter 的 M8-M10 缺陷
- M8 DEF_KEY_FUNC 返回值改为值初始化,键缺失或类型不符时不再返回栈上垃圾值 - M9 getter 内对 m_pXDataMap 判空,避免空 map 构造的 impl 直接崩溃 - M10 GetType 读取 KEY_TYPE 失败时输出日志,不再静默返回 0 - 两份 DEF_KEY_FUNC 定义(XEquipmentImpl.h 与 ParamEquImpl.h)同步修改
This commit is contained in:
1 parent
a51a550a99
commit
39634dc86a
3 files changed
+8
-5
No files matched your search
@@ -54,8 +54,9 @@ public:\
|
|||||||
static const CString key;\
|
static const CString key;\
|
||||||
##type Get##key() const\
|
##type Get##key() const\
|
||||||
{\
|
{\
|
||||||
type v;\
|
type v = type();\
|
||||||
m_pXDataMap->GetAt(key, v);\
|
if (m_pXDataMap)\
|
||||||
|
m_pXDataMap->GetAt(key, v);\
|
||||||
return v;\
|
return v;\
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -132,7 +132,8 @@ int AecDbXEquipment::GetType() const
|
|||||||
{
|
{
|
||||||
assertReadEnabled();
|
assertReadEnabled();
|
||||||
int nType = 0;
|
int nType = 0;
|
||||||
m_mapSpecXData.GetAt(KEY_TYPE, nType);
|
if (!m_mapSpecXData.GetAt(KEY_TYPE, nType))
|
||||||
|
acutPrintf(_T("\nAecDbXEquipment 缺少设备类型数据(KEY_TYPE),按 0 处理。"));
|
||||||
return nType;
|
return nType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,8 +43,9 @@ public:\
|
|||||||
static const CString key;\
|
static const CString key;\
|
||||||
##type Get##key() const\
|
##type Get##key() const\
|
||||||
{\
|
{\
|
||||||
type v;\
|
type v = type();\
|
||||||
m_pXDataMap->GetAt(key, v);\
|
if (m_pXDataMap)\
|
||||||
|
m_pXDataMap->GetAt(key, v);\
|
||||||
return v;\
|
return v;\
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user