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>
This commit is contained in:
Andy Shaw 2012-12-17 11:53:55 +01:00 committed by The Qt Project
parent f2dbf6a819
commit 9f28f8bcbb

View File

@ -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);