diff --git a/fb/fb.h b/fb/fb.h index df430b8fd..65fa17356 100644 --- a/fb/fb.h +++ b/fb/fb.h @@ -168,6 +168,11 @@ typedef CARD32 FbStip; typedef int FbStride; +#define CHECK_NULL(ptr) \ + if ((ptr) == NULL) {\ + ErrorF("%s:%d: null pointer\n", __FILE__, __LINE__); \ + return; \ + } #ifdef FB_DEBUG extern void fbValidateDrawable(DrawablePtr d); @@ -717,6 +722,7 @@ typedef struct { (pointer) = (FbBits *) _pPix->devPrivate.ptr; \ (stride) = ((int) _pPix->devKind) / sizeof (FbBits); (void)(stride); \ (bpp) = _pPix->drawable.bitsPerPixel; (void)(bpp); \ + CHECK_NULL(pointer); \ } #define fbGetStipDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \ @@ -734,6 +740,7 @@ typedef struct { (pointer) = (FbStip *) _pPix->devPrivate.ptr; \ (stride) = ((int) _pPix->devKind) / sizeof (FbStip); (void)(stride); \ (bpp) = _pPix->drawable.bitsPerPixel; (void)(bpp); \ + CHECK_NULL(pointer); \ } /*