diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 4c056626ef1e..2ca334a61038 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -2135,7 +2135,7 @@ void SymbolDatabase::validateExecutableScopes() const for (std::size_t i = 0; i < functions; ++i) { const Scope* const scope = functionScopes[i]; const Function* const function = scope->function; - if (scope->isExecutable() && !function) { + if (mErrorLogger && scope->isExecutable() && !function) { const std::list callstack(1, scope->classDef); const std::string msg = std::string("Executable scope '") + scope->classDef->str() + "' with unknown function."; const ErrorMessage errmsg(callstack, &mTokenizer.list, Severity::debug, @@ -2202,7 +2202,7 @@ void SymbolDatabase::debugSymbolDatabase() const for (const Token* tok = mTokenizer.list.front(); tok != mTokenizer.list.back(); tok = tok->next()) { if (tok->astParent() && tok->astParent()->getTokenDebug() == tok->getTokenDebug()) continue; - if (tok->getTokenDebug() == TokenDebug::ValueType) { + if (mErrorLogger && tok->getTokenDebug() == TokenDebug::ValueType) { std::string msg = "Value type is "; ErrorPath errorPath; diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index fc6c56ab687f..d25ae371c797 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -1149,7 +1149,7 @@ void Tokenizer::simplifyTypedefCpp() return; if (maxTime > 0 && std::time(nullptr) > maxTime) { - if (mSettings.debugwarnings) { + if (mErrorLogger && mSettings.debugwarnings) { ErrorMessage::FileLocation loc; loc.setfile(list.getFiles()[0]); ErrorMessage errmsg({std::move(loc)}, @@ -3405,6 +3405,7 @@ bool Tokenizer::simplifyTokens1(const std::string &configuration) const bool doValueFlow = !disableValueflowEnv || (std::strcmp(disableValueflowEnv, "1") != 0); if (doValueFlow) { + assert(mErrorLogger); if (mTimerResults) { Timer t("Tokenizer::simplifyTokens1::ValueFlow", mSettings.showtime, mTimerResults); ValueFlow::setValues(list, *mSymbolDatabase, *mErrorLogger, mSettings, mTimerResults); @@ -6066,7 +6067,8 @@ void Tokenizer::dump(std::ostream &out) const out << outs; outs.clear(); - mSymbolDatabase->printXml(out); + if (mSymbolDatabase) + mSymbolDatabase->printXml(out); containers.erase(nullptr); if (!containers.empty()) {