diff options
author | Andy Shaw <andy.shaw@digia.com> | 2012-12-17 11:53:55 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-12-20 06:30:07 +0100 |
commit | 9f28f8bcbbf72d737616bcf57820c1e4bef3be95 (patch) | |
tree | 2cf46a7f8f4e185fc28953471a740eb4d0479dad /src/plugins | |
parent | f2dbf6a8194cd244c08cde3cc008f4a6e21caee8 (diff) |
Prevent a crash if the pixmap passed in is null
If the pixmap passed in is null then we should not try to create a
NSImage for it, so we just return 0 instead.
Change-Id: Idae7ba304c97878e0aa8ae1eead5f4bb644a73de
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoahelpers.mm | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index c1146612a6..e242b4e366 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -138,6 +138,8 @@ NSImage *qt_mac_cgimage_to_nsimage(CGImageRef image) NSImage *qt_mac_create_nsimage(const QPixmap &pm) { + if (pm.isNull()) + return 0; QImage image = pm.toImage(); CGImageRef cgImage = qt_mac_image_to_cgimage(image); NSImage *nsImage = qt_mac_cgimage_to_nsimage(cgImage); |