summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXDraw.c
diff options
context:
space:
mode:
authorculler <culler>2019-11-09 14:49:43 (GMT)
committerculler <culler>2019-11-09 14:49:43 (GMT)
commit1ba2cee840613a4386f80189fce4169061cc6f40 (patch)
tree1f252071d23f005d25411b8abcfbe4818523a4b3 /macosx/tkMacOSXDraw.c
parentf51d73def011d920a123d35863c79a9c0e253016 (diff)
downloadtk-1ba2cee840613a4386f80189fce4169061cc6f40.zip
tk-1ba2cee840613a4386f80189fce4169061cc6f40.tar.gz
tk-1ba2cee840613a4386f80189fce4169061cc6f40.tar.bz2
Fix [53d28027e3]: Generate an error instead of a crash if wm iconphoto receives an invalid photo image.
Diffstat (limited to 'macosx/tkMacOSXDraw.c')
-rw-r--r--macosx/tkMacOSXDraw.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index 5714bf4..3f7ca0a 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -501,9 +501,12 @@ TkMacOSXGetNSImageWithTkImage(
int width,
int height)
{
- Pixmap pixmap = Tk_GetPixmap(display, None, width, height, 0);
+ Pixmap pixmap;
NSImage *nsImage;
-
+ if (width == 0 | height == 0) {
+ return NULL;
+ }
+ pixmap = Tk_GetPixmap(display, None, width, height, 0);
Tk_RedrawImage(image, 0, 0, width, height, pixmap, 0, 0);
nsImage = CreateNSImageWithPixmap(pixmap, width, height);
Tk_FreePixmap(display, pixmap);