diff --git a/lib/library.cpp b/lib/library.cpp index bf9d0ce5f74..07c7ffa6892 100644 --- a/lib/library.cpp +++ b/lib/library.cpp @@ -1435,10 +1435,10 @@ bool Library::matchArguments(const Token *ftok, const std::string &functionName, { if (functionName.empty()) return false; - const int callargs = numberOfArgumentsWithoutAst(ftok); const std::unordered_map::const_iterator it = mData->mFunctions.find(functionName); if (it == mData->mFunctions.cend()) return false; + const int callargs = numberOfArgumentsWithoutAst(ftok); int args = 0; int firstOptionalArg = -1; for (const std::pair & argCheck : it->second.argumentChecks) {