diff --git a/src/p_spec.c b/src/p_spec.c index 64d9a5914..b8250e4bb 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1773,15 +1773,17 @@ void P_SwitchWeather(INT32 weathernum) if (purge) { thinker_t *think; + thinker_t *next; precipmobj_t *precipmobj; - for (think = thinkercap.next; think != &thinkercap; think = think->next) + for (think = thinkercap.next; think != &thinkercap; think = next) { + next = think->next; + if (think->function.acp1 != (actionf_p1)P_NullPrecipThinker) continue; // not a precipmobj thinker precipmobj = (precipmobj_t *)think; - P_FreePrecipMobj(precipmobj); } } @@ -1795,6 +1797,7 @@ void P_SwitchWeather(INT32 weathernum) { if (think->function.acp1 != (actionf_p1)P_NullPrecipThinker) continue; // not a precipmobj thinker + precipmobj = (precipmobj_t *)think; if (swap == PRECIP_RAIN) // Snow To Rain