QMimeMagicRule: Fix missing check and return for "Invalid" type

In the QMimeMagicRule constructor.

Change-Id: Icdd1c4bc0e8d7cc39c8f63b416deec84b2607c96
Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
Eike Ziller 2022-02-28 17:15:37 +01:00
parent e7586119e1
commit 9d4e6d560a

View File

@ -231,8 +231,11 @@ QMimeMagicRule::QMimeMagicRule(const QString &type,
m_mask(mask),
m_matchFunction(nullptr)
{
if (Q_UNLIKELY(m_type == Invalid))
*errorString = QLatin1String("Type ") + type + QLatin1String(" is not supported");
if (Q_UNLIKELY(m_type == Invalid)) {
if (errorString)
*errorString = QLatin1String("Type ") + type + QLatin1String(" is not supported");
return;
}
// Parse for offset as "1" or "1:10"
const int colonIndex = offsets.indexOf(QLatin1Char(':'));