From 20a1f876286e3f5cff7bae7dabd9c37629d61336 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Tue, 16 Nov 2010 08:52:49 +0000 Subject: [PATCH] vertex-buffer: don't unref NULL object In cogl_vertex_buffer_indices_get_for_quads() we sometimes have to extend the length of an existing array, but when we came to unref the previous array we didn't first check that it wasn't simply NULL. --- cogl/cogl-vertex-buffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cogl/cogl-vertex-buffer.c b/cogl/cogl-vertex-buffer.c index dee14f4c7..09f5a2038 100644 --- a/cogl/cogl-vertex-buffer.c +++ b/cogl/cogl-vertex-buffer.c @@ -1725,7 +1725,8 @@ cogl_vertex_buffer_indices_get_for_quads (unsigned int n_indices) } else { - if (ctx->quad_buffer_indices_len < n_indices) + if (ctx->quad_buffer_indices && + ctx->quad_buffer_indices_len < n_indices) { cogl_handle_unref (ctx->quad_buffer_indices); ctx->quad_buffer_indices = COGL_INVALID_HANDLE;