Fix QTest::qExec crash with no command line arguments
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>
This commit is contained in:
parent
194e0bd7e4
commit
afb0260f50
@ -2114,7 +2114,8 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
|
||||
QTEST_ASSERT(metaObject);
|
||||
|
||||
QTestResult::setCurrentTestObject(metaObject->className());
|
||||
QTestResult::setCurrentAppname(argv[0]);
|
||||
if (argc > 0)
|
||||
QTestResult::setCurrentAppname(argv[0]);
|
||||
|
||||
qtest_qParseArgs(argc, argv, false);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user