summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qvariant_p.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-01-23 10:31:16 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2017-08-04 11:19:25 +0000
commitf2c6e10ad59c0660b772bff7715fb232cdbe394c (patch)
tree59646dbc12f2ea11c89bcb6392b6bb78ba510dcc /src/corelib/kernel/qvariant_p.h
parent341bfcd1eaa9116c143e3b7d3219ef04c7b8a0cb (diff)
QVariants of null pointers should be null
Changes the QVariant::isNull() implementation for pointer types so they return true if null. [ChangeLog][QVariant] QVariants containing pointers will now return true on isNull() if the contained pointer is null. Change-Id: I8aa0dab482403837073fb2f376a46126cc3bc6b2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qvariant_p.h')
-rw-r--r--src/corelib/kernel/qvariant_p.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/corelib/kernel/qvariant_p.h b/src/corelib/kernel/qvariant_p.h
index 487949431c..75c269d710 100644
--- a/src/corelib/kernel/qvariant_p.h
+++ b/src/corelib/kernel/qvariant_p.h
@@ -187,6 +187,16 @@ public:
}
};
+template <typename T>
+struct PrimitiveIsNull<T*>
+{
+public:
+ static bool isNull(const QVariant::Private *d)
+ {
+ return d->is_null || d->data.ptr == nullptr;
+ }
+};
+
template <>
struct PrimitiveIsNull<std::nullptr_t>
{