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;