i965: avoid segfault in intel_update_renderbuffers() if using DRI1
authorBrian Paul <brianp@vmware.com>
Tue, 28 Apr 2009 15:58:44 +0000 (09:58 -0600)
committerBrian Paul <brianp@vmware.com>
Tue, 28 Apr 2009 15:58:44 +0000 (09:58 -0600)
src/mesa/drivers/dri/intel/intel_context.c

index eb224a8a413e354b73a24a7fe1999937f07e0d5e..a6d8729d8f308453b06c2d3d30668168a3bacf32 100644 (file)
@@ -198,7 +198,7 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
    struct intel_renderbuffer *rb;
    struct intel_region *region, *depth_region;
    struct intel_context *intel = context->driverPrivate;
-   __DRIbuffer *buffers;
+   __DRIbuffer *buffers = NULL;
    __DRIscreen *screen;
    int i, count;
    unsigned int attachments[10];
@@ -210,7 +210,8 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
 
    screen = intel->intelScreen->driScrnPriv;
 
-   if ((screen->dri2.loader->base.version > 2)
+   if (screen->dri2.loader
+       && (screen->dri2.loader->base.version > 2)
        && (screen->dri2.loader->getBuffersWithFormat != NULL)) {
       struct intel_renderbuffer *depth_rb;
       struct intel_renderbuffer *stencil_rb;
@@ -248,7 +249,7 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
                                                      attachments, i / 2,
                                                      &count,
                                                      drawable->loaderPrivate);
-   } else {
+   } else if (screen->dri2.loader) {
       i = 0;
       if (intel_fb->color_rb[0])
         attachments[i++] = __DRI_BUFFER_FRONT_LEFT;