Skip to content

Commit 4601e40

Browse files
committed
Simplify code for finding string format token
1 parent e9b4cbb commit 4601e40

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

lib/checkio.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,12 @@ static bool findFormat(unsigned int arg, const Token *firstArg,
480480
argTok->variable()->dimensionKnown(0) &&
481481
argTok->variable()->dimension(0) != 0))) {
482482
*formatArgTok = argTok->nextArgument();
483-
if (!argTok->values().empty() && argTok->values().front().isTokValue() && argTok->values().front().tokvalue && argTok->values().front().tokvalue->tokType() == Token::eString)
484-
*formatStringTok = argTok->values().front().tokvalue;
483+
if (!argTok->values().empty()) {
484+
const ValueFlow::Value &value = argTok->values().front();
485+
if (value.isTokValue() && value.tokvalue && value.tokvalue->tokType() == Token::eString) {
486+
*formatStringTok = value.tokvalue;
487+
}
488+
}
485489
return true;
486490
}
487491
return false;

0 commit comments

Comments
 (0)