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)