diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c
index 0dceaa809493cb9411ff97364971af5afe0b97d6..086eaaea0ad0a7dfaef42fffc41ff1d25c6c5097 100644
--- a/dlls/gdi32/dib.c
+++ b/dlls/gdi32/dib.c
@@ -1097,6 +1097,8 @@ HBITMAP WINAPI CreateDIBitmap( HDC hdc, const BITMAPINFOHEADER *header,
     DWORD compr, size;
     DC *dc;
 
+    if (!header) return 0;
+
     if (DIB_GetBitmapInfo( header, &width, &height, &planes, &bpp, &compr, &size ) == -1) return 0;
     
     if (width < 0)
diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c
index bfbeee05670a51fb4faa88bf348b47bbc3f4d314..a0d4531d511bf8662198fd998288e458c72a281a 100644
--- a/dlls/gdi32/tests/bitmap.c
+++ b/dlls/gdi32/tests/bitmap.c
@@ -144,7 +144,12 @@ static void test_createdibitmap(void)
     bmih.biPlanes = 1;
     bmih.biBitCount = 32;
     bmih.biCompression = BI_RGB;
- 
+
+    hbm = CreateDIBitmap(hdc, NULL, CBM_INIT, NULL, NULL, 0);
+    ok(hbm == NULL, "CreateDIBitmap should fail\n");
+    hbm = CreateDIBitmap(hdc, NULL, 0, NULL, NULL, 0);
+    ok(hbm == NULL, "CreateDIBitmap should fail\n");
+
     /* First create an un-initialised bitmap.  The depth of the bitmap
        should match that of the hdc and not that supplied in bmih.
     */