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.
This commit is contained in:
Robert Bragg 2010-11-16 08:52:49 +00:00
parent f473c213fc
commit 78ac92f8e5

View File

@ -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;