core: (fixes #1049) add error message to ObjectFactory::Create

This commit is contained in:
Tommaso Pecorella
2024-03-12 23:02:10 +01:00
committed by Tommaso Pecorella
parent 3f5d421fe7
commit b0696dd8fe

View File

@@ -205,7 +205,11 @@ Ptr<T>
ObjectFactory::Create() const
{
Ptr<Object> object = Create();
return object->GetObject<T>();
auto obj = object->GetObject<T>();
NS_ASSERT_MSG(obj != nullptr,
"ObjectFactory::Create error: incompatible types ("
<< T::GetTypeId().GetName() << " and " << object->GetInstanceTypeId() << ")");
return obj;
}
template <typename... Args>