From 9f28f8bcbbf72d737616bcf57820c1e4bef3be95 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 17 Dec 2012 11:53:55 +0100 Subject: Prevent a crash if the pixmap passed in is null MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/plugins/platforms/cocoa/qcocoahelpers.mm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/plugins/platforms') 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); -- cgit v1.2.3