From 612ba7101d3a4042ac23e2b27e5f68471037c176 Mon Sep 17 00:00:00 2001 From: Max Wash Date: Sun, 31 May 2026 17:24:11 +0100 Subject: [PATCH] fx: object: handle nullptr in object_ref and object_unref --- fx/object.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fx/object.c b/fx/object.c index a89936c..8aa8631 100644 --- a/fx/object.c +++ b/fx/object.c @@ -200,12 +200,19 @@ enum fx_status fx_object_get_data( struct _fx_object *fx_object_ref(struct _fx_object *p) { - p->obj_ref++; + 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;