Fix issue 9882: segfault in ForwardTraversal (#2785)
This commit is contained in:
parent
e802d85315
commit
5099ca3c8b
|
@ -412,7 +412,7 @@ static void setTokenValue(Token* tok, const ValueFlow::Value &value, const Setti
|
|||
|
||||
if (value.isContainerSizeValue()) {
|
||||
// .empty, .size, +"abc", +'a'
|
||||
if (parent->str() == "+") {
|
||||
if (parent->str() == "+" && parent->astOperand1() && parent->astOperand2()) {
|
||||
for (const ValueFlow::Value &value1 : parent->astOperand1()->values()) {
|
||||
for (const ValueFlow::Value &value2 : parent->astOperand2()->values()) {
|
||||
if (value1.path != value2.path)
|
||||
|
|
|
@ -4715,6 +4715,15 @@ private:
|
|||
" return x;\n"
|
||||
"}\n";
|
||||
valueOfTok(code, "x");
|
||||
|
||||
code = "void f() {\n"
|
||||
" std::string a = b[c->d()];\n"
|
||||
" if(a.empty()) {\n"
|
||||
" INFO(std::string{\"a\"} + c->d());\n"
|
||||
" INFO(std::string{\"b\"} + a);\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
valueOfTok(code, "a");
|
||||
}
|
||||
|
||||
void valueFlowHang() {
|
||||
|
|
Loading…
Reference in New Issue