Check for a valid context
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 4c64281..612746a 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -328,7 +328,8 @@
    fb->Height = height;
 
    /* to update scissor / window bounds */
-   _mesa_update_draw_buffer_bounds(ctx);
+   if (ctx)
+      _mesa_update_draw_buffer_bounds(ctx);
 }