summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndy Shaw <qt-info@nokia.com>2009-08-10 06:13:55 (GMT)
committerAndy Shaw <qt-info@nokia.com>2009-08-10 06:13:55 (GMT)
commitc3e785eec23322cb2d8eb1cbb6460802ad0a4fe9 (patch)
tree4e708a953d443c38ae98f691eb76538dbcf8a14a /src
parentb55ef69930ff9e26c13845a692fabb709f1c685f (diff)
downloadQt-c3e785eec23322cb2d8eb1cbb6460802ad0a4fe9.zip
Qt-c3e785eec23322cb2d8eb1cbb6460802ad0a4fe9.tar.gz
Qt-c3e785eec23322cb2d8eb1cbb6460802ad0a4fe9.tar.bz2
Prevent a crash when there is no QTest::logger when calling warn()
Also, the info() function was modified to use an assert rather than an pointer check with an if to make it consistent with the rest of the file. Reviewed-by: jesperht
Diffstat (limited to 'src')
-rw-r--r--src/testlib/qtestlog.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp
index 3ca5496..c7b2c17 100644
--- a/src/testlib/qtestlog.cpp
+++ b/src/testlib/qtestlog.cpp
@@ -297,6 +297,7 @@ void QTestLog::stopLogging()
void QTestLog::warn(const char *msg)
{
+ QTEST_ASSERT(QTest::testLogger);
QTEST_ASSERT(msg);
QTest::testLogger->addMessage(QAbstractTestLogger::Warn, msg);
@@ -304,9 +305,10 @@ void QTestLog::warn(const char *msg)
void QTestLog::info(const char *msg, const char *file, int line)
{
+ QTEST_ASSERT(QTest::testLogger);
QTEST_ASSERT(msg);
+ QTEST_ASSERT(file);
- if (QTest::testLogger)
QTest::testLogger->addMessage(QAbstractTestLogger::Info, msg, file, line);
}