diff --git a/plugins/custom-definesandincludes/compilerprovider/compilerprovider.cpp b/plugins/custom-definesandincludes/compilerprovider/compilerprovider.cpp --- a/plugins/custom-definesandincludes/compilerprovider/compilerprovider.cpp +++ b/plugins/custom-definesandincludes/compilerprovider/compilerprovider.cpp @@ -138,6 +138,10 @@ if (item) { languageType = Utils::languageType(item->path(), config.parserArguments.parseAmbiguousAsCPP); } + // If called on files that we can't compile, return an empty set of defines. + if (languageType == Utils::Other) { + return {}; + } return config.compiler->defines(languageType, languageType == Utils::C ? config.parserArguments.cArguments : config.parserArguments.cppArguments); @@ -150,6 +154,10 @@ if (item) { languageType = Utils::languageType(item->path(), config.parserArguments.parseAmbiguousAsCPP); } + // If called on files that we can't compile, return an empty set of includes. + if (languageType == Utils::Other) { + return {}; + } return config.compiler->includes(languageType, languageType == Utils::C ? config.parserArguments.cArguments : config.parserArguments.cppArguments);