summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2022-01-17 09:38:22 -0800
committerThiago Macieira <thiago.macieira@intel.com>2022-01-18 03:56:40 +0000
commita59e7361714d50687d82a2d9abae9e95825a23b6 (patch)
tree0bf9d422eea1f40009665aceebfc0c27b693fc7c /src
parent9ab44777d6818a50cb02d745ff3eaf6b07adb394 (diff)
QMetaType: add a missing check for null d_ptr
Bug introduced in 6.0. This is the only unprotected d_ptr I could find. [ChangeLog][QtCore][QMetaType] Fixed a bug that would cause QMetaType::compare() and QVariant::compare() to crash on invalid meta types and variants. Pick-to: 6.2 6.3 Fixes: QTBUG-99960 Change-Id: I0e5f6bec596a4a78bd3bfffd16cb1f7b2d146688 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qmetatype.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index 4828ba0764..59b1f23d21 100644
--- a/src/corelib/kernel/qmetatype.cpp
+++ b/src/corelib/kernel/qmetatype.cpp
@@ -750,7 +750,7 @@ QPartialOrdering QMetaType::compare(const void *lhs, const void *rhs) const
{
if (!lhs || !rhs)
return QPartialOrdering::Unordered;
- if (d_ptr->flags & QMetaType::IsPointer)
+ if (d_ptr && d_ptr->flags & QMetaType::IsPointer)
return threeWayCompare(*reinterpret_cast<const void * const *>(lhs),
*reinterpret_cast<const void * const *>(rhs));
if (d_ptr && d_ptr->lessThan) {