smol fix to P_SetTarget

This commit is contained in:
Alug committed 2024-07-28 16:37:07 +02:00
1 parent 519e23ec36
commit 97c01c5951
1 file changed
+5 -1
+5 -1
View File
@@ -290,8 +290,12 @@ mobj_t *P_SetTarget(mobj_t **mop, mobj_t *targ)
{
if (*mop) // If there was a target already, decrease its refcount
(*mop)->thinker.references--;
if ((*mop = targ) != NULL) // Set new target and if non-NULL, increase its counter
if (targ != NULL) // Set new target and if non-NULL, increase its counter
targ->thinker.references++;
*mop = targ;
return targ;
}