r300: don't crash if there's no colorbuffer
authorMaciej Cencora <m.cencora@gmail.com>
Tue, 9 Mar 2010 22:13:19 +0000 (23:13 +0100)
committerMaciej Cencora <m.cencora@gmail.com>
Tue, 9 Mar 2010 22:13:19 +0000 (23:13 +0100)
src/mesa/drivers/dri/r300/r300_state.c

index bdd12c6d220b54be1f3cb5f3a96a5358558ca870..874894124195c416ce0faf994622a56c69648a80 100644 (file)
@@ -2245,8 +2245,13 @@ static void r300SetupUsOutputFormat(GLcontext *ctx)
 {
        r300ContextPtr rmesa = R300_CONTEXT(ctx);
        uint32_t hw_format;
+       struct radeon_renderbuffer *rrb = radeon_get_colorbuffer(&rmesa->radeon);
 
-       switch (radeon_get_colorbuffer(&rmesa->radeon)->base.Format)
+       if (!rrb) {
+               return;
+       }
+       
+       switch (rrb->base.Format)
        {
                case MESA_FORMAT_RGBA5551:
                case MESA_FORMAT_RGBA8888: