check for ctx==NULL, bug 4087
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index f2993b1..956527e 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -226,7 +226,8 @@
    fb->Height = height;
 
    /* to update scissor / window bounds */
-   ctx->NewState |= _NEW_BUFFERS;
+   if (ctx)
+      ctx->NewState |= _NEW_BUFFERS;
 }