From 7b1a3ba027cf729e2bbc205801595a1d82b75a27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 23 Aug 2017 15:22:35 +0200 Subject: Fix QCFType::constructFromGet() crash when passed a nullptr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I83cbbb47af8580fa67cbc75fee07bc1e123895eb Reviewed-by: Simon Hausmann Reviewed-by: Tor Arne Vestbø --- src/corelib/kernel/qcore_mac_p.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h index d0edef33a2..b87babc07a 100644 --- a/src/corelib/kernel/qcore_mac_p.h +++ b/src/corelib/kernel/qcore_mac_p.h @@ -111,7 +111,8 @@ public: template X as() const { return reinterpret_cast(type); } static QCFType constructFromGet(const T &t) { - CFRetain(t); + if (t) + CFRetain(t); return QCFType(t); } protected: -- cgit v1.2.3