From 6eccb2e36c1d4ac8615a91a0147cd8b37b8024ff Mon Sep 17 00:00:00 2001 From: Paul Fultz II Date: Fri, 9 Dec 2022 00:17:16 -0600 Subject: [PATCH] Throw internal error when tokens are not in order (#4623) * Throw internal error when tokens are not in order * Add semicolon --- lib/valueflow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 72e9d0af4..004381ea4 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -5331,6 +5331,8 @@ static void valueFlowForwardConst(Token* start, const Settings* const settings, int /*unused*/ = 0) { + if (!precedes(start, end)) + throw InternalError(var->nameToken(), "valueFlowForwardConst: start token does not precede the end token."); for (Token* tok = start; tok != end; tok = tok->next()) { if (tok->varId() == var->declarationId()) { for (const ValueFlow::Value& value : values)