diff --git a/Modules.cpp b/Modules.cpp index 309f3723..202fdad9 100644 --- a/Modules.cpp +++ b/Modules.cpp @@ -1013,6 +1013,12 @@ CModules::ModDirList CModules::GetModDirs() { ModHandle CModules::OpenModule(const CString& sModule, const CString& sModPath, bool &bVersionMismatch, bool &bIsGlobal, CString& sDesc, CString& sRetMsg) { + // Some sane defaults in case anything errors out below + bVersionMismatch = false; + bIsGlobal = false; + sDesc.clear(); + sRetMsg.clear(); + for (unsigned int a = 0; a < sModule.length(); a++) { if (((sModule[a] < '0') || (sModule[a] > '9')) && ((sModule[a] < 'a') || (sModule[a] > 'z')) && ((sModule[a] < 'A') || (sModule[a] > 'Z')) && (sModule[a] != '_')) { sRetMsg = "Module names can only contain letters, numbers and underscores, [" + sModule + "] is invalid."; @@ -1054,15 +1060,14 @@ ModHandle CModules::OpenModule(const CString& sModule, const CString& sModPath, return false; } - bIsGlobal = IsGlobal(); - sDesc = GetDesc(); - if (CModule::GetCoreVersion() != Version()) { bVersionMismatch = true; sRetMsg = "Version mismatch, recompile this module."; } else { sRetMsg = ""; bVersionMismatch = false; + bIsGlobal = IsGlobal(); + sDesc = GetDesc(); } return p;