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:
parent
f2dbf6a819
commit
9f28f8bcbb
@ -138,6 +138,8 @@ NSImage *qt_mac_cgimage_to_nsimage(CGImageRef image)
|
|||||||
|
|
||||||
NSImage *qt_mac_create_nsimage(const QPixmap &pm)
|
NSImage *qt_mac_create_nsimage(const QPixmap &pm)
|
||||||
{
|
{
|
||||||
|
if (pm.isNull())
|
||||||
|
return 0;
|
||||||
QImage image = pm.toImage();
|
QImage image = pm.toImage();
|
||||||
CGImageRef cgImage = qt_mac_image_to_cgimage(image);
|
CGImageRef cgImage = qt_mac_image_to_cgimage(image);
|
||||||
NSImage *nsImage = qt_mac_cgimage_to_nsimage(cgImage);
|
NSImage *nsImage = qt_mac_cgimage_to_nsimage(cgImage);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user