r300g: fix SIGFPE on debug builds
authorMarek Olšák <maraeo@gmail.com>
Tue, 15 Feb 2011 00:19:01 +0000 (01:19 +0100)
committerMarek Olšák <maraeo@gmail.com>
Tue, 15 Feb 2011 00:19:54 +0000 (01:19 +0100)
src/gallium/drivers/r300/r300_state.c

index 1ec942854ff8cfb8a33f25f10f0658b2d53f3dc1..aa18ab7d1e3d16072c2728c3c818f4c0c168aefc 100644 (file)
@@ -1511,9 +1511,9 @@ static void r300_set_index_buffer(struct pipe_context* pipe,
 {
     struct r300_context* r300 = r300_context(pipe);
 
-    assert(ib->offset % ib->index_size == 0);
-
     if (ib && ib->buffer) {
+        assert(ib->offset % ib->index_size == 0);
+
         pipe_resource_reference(&r300->index_buffer.buffer, ib->buffer);
         memcpy(&r300->index_buffer, ib, sizeof(r300->index_buffer));
         r300->index_buffer.offset /= r300->index_buffer.index_size;