fix issues

- fix nullptr name assignment error on CKObject.
- remove slot check for CKTexture::GetFileName in BMap. return nullptr, not throw error when no slot to get file name.
This commit is contained in:
yyc12345 2023-11-15 23:05:21 +08:00
parent d8b7ace53d
commit 7c6dd463bd
2 changed files with 5 additions and 4 deletions

View File

@ -371,8 +371,6 @@ bool BMTexture_GetFileName(BMPARAM_OBJECT_DECL(bmfile, objid), BMPARAM_OUT(LibCm
auto obj = CheckCKTexture(bmfile, objid);
if (obj == nullptr) return false;
if (obj->GetUnderlyingData().GetSlotCount() == 0) return false;
BMPARAM_OUT_ASSIGN(out_filename, obj->GetUnderlyingData().GetSlotFileName(0));
return true;
}

View File

@ -5,9 +5,12 @@ namespace LibCmo::CK2::ObjImpls {
CKObject::CKObject(CKContext* ctx, CK_ID ckid, CKSTRING name) :
m_ID(ckid),
m_Name(name),
m_Name(),
m_Context(ctx),
m_ObjectFlags(CK_OBJECT_FLAGS::CK_PARAMETERIN_DISABLED) {}
m_ObjectFlags(CK_OBJECT_FLAGS::CK_PARAMETERIN_DISABLED) {
// set name with possible nullptr.
XContainer::NSXString::FromCKSTRING(m_Name, name);
}
CKObject::~CKObject() {}