diff options
author | Jake Petroules <jake.petroules@theqtcompany.com> | 2015-12-02 00:27:49 -0800 |
---|---|---|
committer | Jake Petroules <jake.petroules@theqtcompany.com> | 2015-12-02 16:32:12 +0000 |
commit | 4f1b6749c3f07bfa44b92f8261a03d650f54166b (patch) | |
tree | a1ecc2d741ef5ef005bafb706ec10151ff4f3da0 /src/gui/image | |
parent | ccc6d545c2511674125adea11dc00d08a34b67b3 (diff) |
Fix possible null pointer dereferences.
This follows up 130c2baa9376dcf525916620294bd9996bdf41f3.
Change-Id: I2f6c9b4f995af427cec9a2162b782039debf8564
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Diffstat (limited to 'src/gui/image')
-rw-r--r-- | src/gui/image/qicon.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index b2d9ed18f5..dc6cbfed1f 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -1208,6 +1208,12 @@ bool QIcon::hasThemeIcon(const QString &name) */ void QIcon::setIsMask(bool isMask) { + if (!d) { + d = new QIconPrivate; + d->engine = new QPixmapIconEngine; + } else { + detach(); + } d->is_mask = isMask; } @@ -1222,6 +1228,8 @@ void QIcon::setIsMask(bool isMask) */ bool QIcon::isMask() const { + if (!d) + return false; return d->is_mask; } |