The documentation for QTest::qExec states that command line arguments
are optional and gives the following example:
MyTestObject test1;
QTest::qExec(&test1);
However, running this example leads to crash as argv[0] is accessed
without testing argc. This change fixes this bug.
Change-Id: I2ec016e02869d21b24bc11f1851a760036640191
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jason McDonald <macadder1@gmail.com>
QTEST_ASSERT(metaObject);
QTestResult::setCurrentTestObject(metaObject->className());
- QTestResult::setCurrentAppname(argv[0]);
+ if (argc > 0)
+ QTestResult::setCurrentAppname(argv[0]);
qtest_qParseArgs(argc, argv, false);