mesa: Add assert to check for null pointer dereference.
authorVinson Lee <vlee@vmware.com>
Sun, 21 Feb 2010 10:13:15 +0000 (02:13 -0800)
committerVinson Lee <vlee@vmware.com>
Sun, 21 Feb 2010 10:13:15 +0000 (02:13 -0800)
src/mesa/main/framebuffer.c

index 065e25fd3325617bf5da98c7ef501fbd2e8d4406..269bc9ac6ca5b685bff260154bdf2a4475989343 100644 (file)
@@ -829,8 +829,12 @@ update_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
 void
 _mesa_update_framebuffer(GLcontext *ctx)
 {
-   struct gl_framebuffer *drawFb = ctx->DrawBuffer;
-   struct gl_framebuffer *readFb = ctx->ReadBuffer;
+   struct gl_framebuffer *drawFb;
+   struct gl_framebuffer *readFb;
+
+   assert(ctx);
+   drawFb = ctx->DrawBuffer;
+   readFb = ctx->ReadBuffer;
 
    update_framebuffer(ctx, drawFb);
    if (readFb != drawFb)