summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-09-02 15:04:09 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-09-02 22:44:26 +0200
commit7f7b60d8d5ca3c3c39753585ea5701b209338599 (patch)
tree8a33584c6c1e73666eb8528b42b245f13e8f54d6 /src/testlib
parente3c08da30770f005210e81e62f6fcfc7064fac44 (diff)
Fix gcc warning about possible call of printf with nullptr
Amends fe4794f70ecc4a302b22ad26614203a70c049a13 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>
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/qabstractitemmodeltester.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/testlib/qabstractitemmodeltester.cpp b/src/testlib/qabstractitemmodeltester.cpp
index 4c86d65e77..58f7b94c66 100644
--- a/src/testlib/qabstractitemmodeltester.cpp
+++ b/src/testlib/qabstractitemmodeltester.cpp
@@ -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;
}