MimeTypeParser: Make sure errorMessage is set

Other methods that call this method check for errorMessage to be
nullptr, so better check here, too.

Change-Id: I8cf4e9d4f5eaafcfc8309dc351ae3b7027c40a98
Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
Tobias Hunger 2016-12-05 17:24:50 +01:00 committed by Tobias Hunger
parent 3c159957f8
commit 1f87726980

View File

@ -165,7 +165,8 @@ bool QMimeTypeParserBase::parseNumber(const QStringRef &n, int *target, QString
bool ok;
*target = n.toInt(&ok);
if (Q_UNLIKELY(!ok)) {
*errorMessage = QLatin1String("Not a number '") + n + QLatin1String("'.");
if (errorMessage)
*errorMessage = QLatin1String("Not a number '") + n + QLatin1String("'.");
return false;
}
return true;