From 97c01c59516e8ff77f71d8c9f60e95aad856e7a5 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 28 Jul 2024 16:37:07 +0200 Subject: [PATCH] smol fix to P_SetTarget --- src/p_tick.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/p_tick.c b/src/p_tick.c index 12f872933..2918b4192 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -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; }