QmlDesigner.Qml2Puppet: crash fix

If if have less then one argument show some help end exit.
The code afterwards assumes that we have at least one argument.

Change-Id: I555e02dc03c2319eef713b880cf43d740d64e942
Reviewed-by: Marco Bubke <marco.bubke@digia.com>
This commit is contained in:
Thomas Hartmann
2013-07-10 17:48:06 +02:00
parent 8828a2fa38
commit 42b4e57f55

View File

@@ -61,6 +61,13 @@ int main(int argc, char *argv[])
QCoreApplication::setApplicationName("Qml2Puppet");
QCoreApplication::setApplicationVersion("1.0.0");
if (application.arguments().count() < 2) {
qDebug() << "Usage:\n";
qDebug() << "--test";
qDebug() << "--version";
return -1;
}
if (application.arguments().count() == 2 && application.arguments().at(1) == "--test") {
qDebug() << QCoreApplication::applicationVersion();
QQmlEngine engine;