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)
This commit is contained in:
Jason McDonald 2011-04-20 15:11:23 +10:00 committed by Rohan McGovern
parent e1f2211188
commit 847ee01953

View File

@ -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;