Utils: Do not dereference nullptr via errorMessage

The errorMessage passed into this function apparently can be a nullptr,
at least everywhere else it is checked whether or not errorMessage is
nullptr before accessing it.

Change-Id: If0920275ebce394a1b7085b815eaa6994b76ee3b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Tobias Hunger
2016-12-05 15:31:40 +01:00
parent e492ee2b14
commit e58020c346

View File

@@ -162,7 +162,8 @@ static bool parseNumber(const QString &n, int *target, QString *errorMessage)
bool ok; bool ok;
*target = n.toInt(&ok); *target = n.toInt(&ok);
if (!ok) { if (!ok) {
*errorMessage = QString::fromLatin1("Not a number '%1'.").arg(n); if (errorMessage)
*errorMessage = QString::fromLatin1("Not a number '%1'.").arg(n);
return false; return false;
} }
return true; return true;