summaryrefslogtreecommitdiffstats
path: root/xlib/ximage.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlib/ximage.c')
-rw-r--r--xlib/ximage.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/xlib/ximage.c b/xlib/ximage.c
index aaab946..b3a8f20 100644
--- a/xlib/ximage.c
+++ b/xlib/ximage.c
@@ -51,11 +51,13 @@ XCreateBitmapFromData(
}
ximage = XCreateImage(display, NULL, 1, XYBitmap, 0, (char*) data, width,
height, 8, (width + 7) / 8);
- ximage->bitmap_bit_order = LSBFirst;
- _XInitImageFuncPtrs(ximage);
- TkPutImage(NULL, 0, display, pix, gc, ximage, 0, 0, 0, 0, width, height);
- ximage->data = NULL;
- XDestroyImage(ximage);
+ if (ximage) {
+ ximage->bitmap_bit_order = LSBFirst;
+ _XInitImageFuncPtrs(ximage);
+ TkPutImage(NULL, 0, display, pix, gc, ximage, 0, 0, 0, 0, width, height);
+ ximage->data = NULL;
+ XDestroyImage(ximage);
+ }
XFreeGC(display, gc);
return pix;
}