diff options
author | Eike Ziller <eike.ziller@qt.io> | 2022-02-28 17:15:37 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2022-03-02 10:43:49 +0100 |
commit | 9d4e6d560a5c3c229bdcaa6b15f2028cc9805346 (patch) | |
tree | d7627eecb58688c62e40987c39f19028c93e2ea7 /src/corelib/mimetypes/qmimemagicrule.cpp | |
parent | e7586119e1ba48844a9353e5b9cb6f0f26292764 (diff) |
QMimeMagicRule: Fix missing check and return for "Invalid" type
In the QMimeMagicRule constructor.
Change-Id: Icdd1c4bc0e8d7cc39c8f63b416deec84b2607c96
Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/corelib/mimetypes/qmimemagicrule.cpp')
-rw-r--r-- | src/corelib/mimetypes/qmimemagicrule.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/corelib/mimetypes/qmimemagicrule.cpp b/src/corelib/mimetypes/qmimemagicrule.cpp index 2c8c2e7199..bb30c11ff5 100644 --- a/src/corelib/mimetypes/qmimemagicrule.cpp +++ b/src/corelib/mimetypes/qmimemagicrule.cpp @@ -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(':')); |