diff options
Diffstat (limited to 'type.cpp')
| -rw-r--r-- | type.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -582,19 +582,19 @@ Ref<Type> Type::NamedType(const QualifiedName& name, Type* type) Ref<Type> Type::NamedType(const string& id, const QualifiedName& name, Type* type) { BNQualifiedName nameObj = name.GetAPIObject(); - Type* result = new Type(BNCreateNamedTypeReferenceFromTypeAndId(id.c_str(), &nameObj, - type ? type->GetObject() : nullptr)); + BNType* coreObj = BNCreateNamedTypeReferenceFromTypeAndId(id.c_str(), &nameObj, + type ? type->GetObject() : nullptr); QualifiedName::FreeAPIObject(&nameObj); - return result; + return coreObj ? new Type(coreObj) : nullptr; } Ref<Type> Type::NamedType(BinaryView* view, const QualifiedName& name) { BNQualifiedName nameObj = name.GetAPIObject(); - Type* result = new Type(BNCreateNamedTypeReferenceFromType(view->GetObject(), &nameObj)); + BNType* coreObj = BNCreateNamedTypeReferenceFromType(view->GetObject(), &nameObj); QualifiedName::FreeAPIObject(&nameObj); - return result; + return coreObj ? new Type(coreObj) : nullptr; } |
