fx: object: handle nullptr in object_ref and object_unref
This commit is contained in:
+8
-1
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user