diff --git a/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp b/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp index a3decd3c458..d386bfbf3af 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp @@ -515,6 +515,13 @@ void ThingTemplate::parseModuleName(INI* ini, void *instance, void* store, const ModuleData* data = TheModuleFactory->newModuleDataFromINI(ini, tokenStr, type, moduleTagStr); + if (data == nullptr) + { + DEBUG_CRASH(("[LINE: %d - FILE: '%s'] Module '%s' (tag '%s') could not be created for object '%s'. Module may not be registered in the ModuleFactory.", + ini->getLineNum(), ini->getFilename().str(), tokenStr.str(), moduleTagStr.str(), self->getName().str())); + throw INI_INVALID_DATA; + } + if (data->isAiModuleData()) { Bool replaced = mi->clearAiModuleInfo(); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp index 54e8b295c96..c0ad60018f2 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp @@ -595,6 +595,13 @@ void ThingTemplate::parseModuleName(INI* ini, void *instance, void* store, const ModuleData* data = TheModuleFactory->newModuleDataFromINI(ini, tokenStr, type, moduleTagStr); + if (data == nullptr) + { + DEBUG_CRASH(("[LINE: %d - FILE: '%s'] Module '%s' (tag '%s') could not be created for object '%s'. Module may not be registered in the ModuleFactory.", + ini->getLineNum(), ini->getFilename().str(), tokenStr.str(), moduleTagStr.str(), self->getName().str())); + throw INI_INVALID_DATA; + } + if (data->isAiModuleData()) { Bool replaced = mi->clearAiModuleInfo();