fx: object: handle nullptr in object_ref and object_unref
This commit is contained in:
@@ -200,12 +200,19 @@ enum fx_status fx_object_get_data(
|
||||
|
||||
struct _fx_object *fx_object_ref(struct _fx_object *p)
|
||||
{
|
||||
if (p) {
|
||||
p->obj_ref++;
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void fx_object_unref(struct _fx_object *p)
|
||||
{
|
||||
if (!p) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (p->obj_ref > 1) {
|
||||
p->obj_ref--;
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user