diff --git a/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp b/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp index 6fa3f401fa2..5655e1fc25d 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 == NULL) + { + DEBUG_CRASH(("[LINE: %d - FILE: '%s'] Module '%s' not found or failed to create for thing template '%s'. This module is not registered in the ModuleFactory. Please check that the module name is spelled correctly and that the module type is appropriate.", + ini->getLineNum(), ini->getFilename().str(), tokenStr.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 1e163cfb177..9bfc4b03ba6 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 == NULL) + { + DEBUG_CRASH(("[LINE: %d - FILE: '%s'] Module '%s' not found or failed to create for thing template '%s'. This module is not registered in the ModuleFactory. Please check that the module name is spelled correctly and that the module type is appropriate.", + ini->getLineNum(), ini->getFilename().str(), tokenStr.str(), self->getName().str())); + throw INI_INVALID_DATA; + } + if (data->isAiModuleData()) { Bool replaced = mi->clearAiModuleInfo();