Fix gcc warning about possible call of printf with nullptr
Amends fe4794f70e
Depending on the types, the generic QTest::toString version might be
used, which returns nullptr.
Change-Id: Ic60675057181629d1cf9cb22e7508d57c026a0ad
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
bb10
parent
e3c08da307
commit
7f7b60d8d5
|
|
@ -822,7 +822,9 @@ bool QAbstractItemModelTesterPrivate::compare(const T1 &t1, const T2 &t2,
|
|||
if (!result) {
|
||||
auto t1string = QTest::toString(t1);
|
||||
auto t2string = QTest::toString(t2);
|
||||
qCWarning(lcModelTest, formatString, actual, t1string, expected, t2string, file, line);
|
||||
qCWarning(lcModelTest, formatString, actual, t1string ? t1string : "(nullptr)",
|
||||
expected, t2string ? t2string : "(nullptr)",
|
||||
file, line);
|
||||
delete [] t1string;
|
||||
delete [] t2string;
|
||||
}
|
||||
|
|
@ -832,7 +834,9 @@ bool QAbstractItemModelTesterPrivate::compare(const T1 &t1, const T2 &t2,
|
|||
if (!result) {
|
||||
auto t1string = QTest::toString(t1);
|
||||
auto t2string = QTest::toString(t2);
|
||||
qFatal(formatString, actual, t1string, expected, t2string, file, line);
|
||||
qFatal(formatString, actual, t1string ? t1string : "(nullptr)",
|
||||
expected, t2string ? t2string : "(nullptr)",
|
||||
file, line);
|
||||
delete [] t1string;
|
||||
delete [] t2string;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue