diff --git a/lib/checkunusedfunctions.cpp b/lib/checkunusedfunctions.cpp index e2eb8452b..738136ccc 100644 --- a/lib/checkunusedfunctions.cpp +++ b/lib/checkunusedfunctions.cpp @@ -95,10 +95,13 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const char Fi // parsing of library code to find called functions if (settings->library.isexecutableblock(FileName, tok->str())) { const Token * markupVarToken = tok->tokAt(settings->library.blockstartoffset(FileName)); + // not found + if (!markupVarToken) + continue; int scope = 0; bool start = true; // find all function calls in library code (starts with '(', not if or while etc) - while (scope || start) { + while ((scope || start) && markupVarToken) { if (markupVarToken->str() == settings->library.blockstart(FileName)) { scope++; if (start) {