diff --git a/src/core/model/object-factory.cc b/src/core/model/object-factory.cc index 7f13067d9..1646fb4a9 100644 --- a/src/core/model/object-factory.cc +++ b/src/core/model/object-factory.cc @@ -93,6 +93,9 @@ Ptr ObjectFactory::Create() const { NS_LOG_FUNCTION(this); + NS_ASSERT_MSG( + m_tid.GetUid(), + "ObjectFactory::Create - can't use an ObjectFactory without setting a TypeId first."); Callback cb = m_tid.GetConstructor(); ObjectBase* base = cb(); auto derived = dynamic_cast(base); diff --git a/src/core/model/type-id.cc b/src/core/model/type-id.cc index 6ebe23380..91241b4c7 100644 --- a/src/core/model/type-id.cc +++ b/src/core/model/type-id.cc @@ -457,7 +457,8 @@ IidManager::IidInformation* IidManager::LookupInformation(uint16_t uid) const { NS_LOG_FUNCTION(IID << uid); - NS_ASSERT(uid <= m_information.size() && uid != 0); + NS_ASSERT_MSG(uid <= m_information.size() && uid != 0, + "The uid " << uid << " for this TypeId is invalid"); NS_LOG_LOGIC(IIDL << m_information[uid - 1].name); return const_cast(&m_information[uid - 1]); }