cogl: Do not unref a NULL object

Add return-if-fail statement to avoid deferencing NULL object
This commit is contained in:
Marco Trevisan (Treviño) 2018-04-19 04:49:01 -05:00 committed by Marco Trevisan
parent 0b3a1c9c31
commit 3104d697c0

View File

@ -109,7 +109,11 @@ _cogl_object_default_unref (void *object)
void void
cogl_object_unref (void *obj) cogl_object_unref (void *obj)
{ {
void (* unref_func) (void *) = ((CoglObject *) obj)->klass->virt_unref; void (* unref_func) (void *);
_COGL_RETURN_IF_FAIL (obj != NULL);
unref_func = ((CoglObject *) obj)->klass->virt_unref;
unref_func (obj); unref_func (obj);
} }