summaryrefslogtreecommitdiff
path: root/src/xlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xlib.c')
-rw-r--r--src/xlib.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/xlib.c b/src/xlib.c
index 37c74b9..765cf9d 100644
--- a/src/xlib.c
+++ b/src/xlib.c
@@ -1,4 +1,5 @@
/*
+ * $Id$
*
* Copyright © 2002 Keith Packard
*
@@ -36,6 +37,9 @@ _XcursorFontIsCursor (Display *dpy, Font font)
int n;
Atom cursor;
+ if (!dpy || !font)
+ return XcursorFalse;
+
if (font == dpy->cursor_font)
return XcursorTrue;
@@ -86,6 +90,9 @@ XcursorTryShapeCursor (Display *dpy,
XColor _Xconst *background)
{
Cursor cursor = None;
+
+ if (!dpy || !source_font || !mask_font || !foreground || !background)
+ return 0;
if (!XcursorSupportsARGB (dpy) && !XcursorGetThemeCore (dpy))
return None;
@@ -120,6 +127,9 @@ XcursorNoticeCreateBitmap (Display *dpy,
int replace = 0;
XcursorBitmapInfo *bmi;
+ if (!dpy)
+ return;
+
if (!XcursorSupportsARGB (dpy) && !XcursorGetThemeCore (dpy))
return;
@@ -160,9 +170,14 @@ XcursorNoticeCreateBitmap (Display *dpy,
static XcursorBitmapInfo *
_XcursorGetBitmap (Display *dpy, Pixmap bitmap)
{
- XcursorDisplayInfo *info = _XcursorGetDisplayInfo (dpy);
+ XcursorDisplayInfo *info;
int i;
+ if (!dpy || !bitmap)
+ return NULL;
+
+ info = _XcursorGetDisplayInfo (dpy);
+
if (!info)
return 0;
LockDisplay (dpy);
@@ -233,6 +248,9 @@ XcursorImageHash (XImage *image,
int low_addr;
Bool bit_swap;
+ if (!image)
+ return;
+
for (i = 0; i < XCURSOR_BITMAP_HASH_SIZE; i++)
hash[i] = 0;
/*
@@ -302,6 +320,9 @@ XcursorNoticePutBitmap (Display *dpy,
XImage *image)
{
XcursorBitmapInfo *bmi;
+
+ if (!dpy || !image)
+ return;
if (!XcursorSupportsARGB (dpy) && !XcursorGetThemeCore (dpy))
return;
@@ -383,6 +404,9 @@ XcursorTryShapeBitmapCursor (Display *dpy,
int i;
Cursor cursor;
+ if (!dpy || !foreground || !background)
+ return 0;
+
if (!XcursorSupportsARGB (dpy) && !XcursorGetThemeCore (dpy))
return None;