fx: object: handle nullptr in object_ref and object_unref

This commit is contained in:
2026-05-31 17:24:11 +01:00
parent fb864a64c9
commit 612ba7101d
+8 -1
View File
@@ -200,12 +200,19 @@ enum fx_status fx_object_get_data(
struct _fx_object *fx_object_ref(struct _fx_object *p) struct _fx_object *fx_object_ref(struct _fx_object *p)
{ {
p->obj_ref++; if (p) {
p->obj_ref++;
}
return p; return p;
} }
void fx_object_unref(struct _fx_object *p) void fx_object_unref(struct _fx_object *p)
{ {
if (!p) {
return;
}
if (p->obj_ref > 1) { if (p->obj_ref > 1) {
p->obj_ref--; p->obj_ref--;
return; return;