diff options
author | Ivan Komissarov <abbapoh@gmail.com> | 2020-02-26 21:52:43 +0100 |
---|---|---|
committer | Ivan Komissarov <ABBAPOH@gmail.com> | 2020-02-27 12:12:11 +0000 |
commit | b8d463545037f031f7038eb8c34c92b14bfdade9 (patch) | |
tree | 60e4a001165f82c37892f1e11b2fd06d0393e410 /src | |
parent | 63d10ed08d65d0259c0781af1dd3c964d75a8a85 (diff) |
Fix the error when the last module candidate is not a module
Previously, if the last module candidate was not a module item, the
value of triedToLoadModule was set to 'false'. However, we could try to
load the one of the previous candidates which means that
triedToLoadModule should be set to 'true'
Change-Id: I03278d51804568ebbd4dee93313c16517fd774e9
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/corelib/language/moduleloader.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/corelib/language/moduleloader.cpp b/src/lib/corelib/language/moduleloader.cpp index 7f794a42a..f55dbd7e9 100644 --- a/src/lib/corelib/language/moduleloader.cpp +++ b/src/lib/corelib/language/moduleloader.cpp @@ -3120,15 +3120,16 @@ Item *ModuleLoader::searchAndLoadModuleFile(ProductContext *productContext, QStringList &moduleFileNames = getModuleFileNames(dirPath); for (auto it = moduleFileNames.begin(); it != moduleFileNames.end(); ) { const QString &filePath = *it; - triedToLoadModule = true; + bool triedToLoad = true; Item *module = loadModuleFile(productContext, fullName, isBaseModule(moduleName), - filePath, &triedToLoadModule, moduleInstance); + filePath, &triedToLoad, moduleInstance); if (module) candidates.emplace_back(module, 0, i); - if (!triedToLoadModule) + if (!triedToLoad) it = moduleFileNames.erase(it); else ++it; + triedToLoadModule = triedToLoadModule || triedToLoad; } } |