File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2781,7 +2781,7 @@ namespace {
27812781 if (var->declarationId () == loopVar->varId ())
27822782 return false ;
27832783 const Scope* scope = var->scope ();
2784- return scope->isNestedIn (bodyTok->scope ());
2784+ return scope && scope ->isNestedIn (bodyTok->scope ());
27852785 }
27862786
27872787 private:
Original file line number Diff line number Diff line change @@ -5476,6 +5476,23 @@ class TestStl : public TestFixture {
54765476 true );
54775477 ASSERT_EQUALS (" [test.cpp:2]: (style) Consider using std::all_of or std::none_of algorithm instead of a raw loop.\n " ,
54785478 errout.str ());
5479+
5480+ check (" class C {\n "
5481+ " private:\n "
5482+ " QString s;\n "
5483+ " public:\n "
5484+ " C(QString);\n "
5485+ " private slots:\n "
5486+ " void f() {\n "
5487+ " QVERIFY(QDir(s).exists());\n "
5488+ " }\n "
5489+ " void f(const QStringList& d) {\n "
5490+ " for (QString f : d)\n "
5491+ " QDir(s);\n "
5492+ " }\n "
5493+ " };\n " ,
5494+ true );
5495+ ASSERT_EQUALS (" " , errout.str ());
54795496 }
54805497
54815498 void invalidContainer () {
You can’t perform that action at this time.
0 commit comments