diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2011-04-20 15:11:23 +1000 |
---|---|---|
committer | Rohan McGovern <rohan.mcgovern@nokia.com> | 2011-05-18 10:46:41 +1000 |
commit | 847ee0195344d3c33d727e6ce97caee1ee95c43e (patch) | |
tree | 71206e99770abc547aebcd11231dc62833db5e38 /tests/auto | |
parent | e1f221118841f80072f3d2223906a6dc21038148 (diff) |
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
(cherry picked from commit 5a530f6171a9569d1a35cd8cd1015ec796b048cc)
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qcopchannel/testSend/main.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/auto/qcopchannel/testSend/main.cpp b/tests/auto/qcopchannel/testSend/main.cpp index 91628e501f..a56883be99 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; |