Make QCommandLineParser not crash if passed a bad QCommandLineOption
This otherwise crashed: QCommandLineOotion opt("with=equals"); parser.isSet(opt); Can't write a unit test because it produces a warning. Change-Id: Ifc67f20bb4b16b96d93dffbe4e82e6cc8a17584d Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
parent
3575ebfd9d
commit
3a26313919
@ -720,7 +720,8 @@ QStringList QCommandLineParser::values(const QString &optionName) const
|
||||
*/
|
||||
bool QCommandLineParser::isSet(const QCommandLineOption &option) const
|
||||
{
|
||||
return isSet(option.names().first());
|
||||
// option.names() might be empty if the constructor failed
|
||||
return !option.names().isEmpty() && isSet(option.names().first());
|
||||
}
|
||||
|
||||
/*!
|
||||
|
Loading…
Reference in New Issue
Block a user