From f2c6e10ad59c0660b772bff7715fb232cdbe394c Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 23 Jan 2017 10:31:16 +0100 Subject: 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 --- src/corelib/kernel/qvariant_p.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/corelib/kernel/qvariant_p.h') 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 +struct PrimitiveIsNull +{ +public: + static bool isNull(const QVariant::Private *d) + { + return d->is_null || d->data.ptr == nullptr; + } +}; + template <> struct PrimitiveIsNull { -- cgit v1.2.3