summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-04-20 05:11:23 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2011-04-20 06:02:16 (GMT)
commit5a530f6171a9569d1a35cd8cd1015ec796b048cc (patch)
treea0f78b3c63e1973181723ab1f5d81cd2aa831c93
parenta5bd4abed834ce3670b2f28d4f932d612a033b36 (diff)
downloadQt-5a530f6171a9569d1a35cd8cd1015ec796b048cc.zip
Qt-5a530f6171a9569d1a35cd8cd1015ec796b048cc.tar.gz
Qt-5a530f6171a9569d1a35cd8cd1015ec796b048cc.tar.bz2
Remove Q_ASSERT from qcopchannel autotest
This code would assert in a debug build and potentially crash in a release build. (The behaviour of QStringList::at() with an out-of-bounds index is undefined.) This commit makes the program exit with a useful error message in all builds. Change-Id: Ia57a2e5693eb25d3eb0b9ba701ed485dfbc1e846 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern
-rw-r--r--tests/auto/qcopchannel/testSend/main.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/auto/qcopchannel/testSend/main.cpp b/tests/auto/qcopchannel/testSend/main.cpp
index 91628e5..a56883b 100644
--- a/tests/auto/qcopchannel/testSend/main.cpp
+++ b/tests/auto/qcopchannel/testSend/main.cpp
@@ -49,7 +49,11 @@ int main(int argc, char** argv)
#ifdef Q_WS_QWS
QApplication app(argc, argv);
QStringList args = app.arguments();
- Q_ASSERT(args.count() == 3 || args.count() == 4);
+ if (args.count() != 3 && args.count() != 4) {
+ fprintf(stdout,qPrintable(QString("Usage: %1 channel message [data]").arg(args.at(0))));
+ fflush(stdout);
+ return 1;
+ }
QString channelName = args.at(1);
QString msg = args.at(2);
QByteArray data;