diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 2810c3fc5..6b2917509 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -6306,6 +6306,8 @@ struct MultiValueFlowAnalyzer : ValueFlowAnalyzer { ProgramState ps; for (const auto& p : values) { const Variable* var = vars.at(p.first); + if (!var) + continue; ps[var->nameToken()] = p.second; } return ps; diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index 38a27ad7e..69e273f54 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -6273,6 +6273,16 @@ private: " }\n" "};\n"; valueOfTok(code, "f.c"); + + code = "void d(fmpz_t a, fmpz_t b) {\n" + " if (fmpz_sgn(0)) {}\n" + " else if (b) {}\n" + "}\n" + "void e(psl2z_t f) {\n" + " f->b;\n" + " d(&f->a, c);\n" + "}\n"; + valueOfTok(code, "f"); } void valueFlowHang() {