From 956b5812e7c49a7d221f99e12dcb13deb5d6ffab Mon Sep 17 00:00:00 2001 From: Sam Truscott Date: Sun, 28 May 2017 16:39:18 +0200 Subject: [PATCH] Fixed #7866 (Crash while scanning QML files) --- lib/checkunusedfunctions.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) {