Skip to content

Fixes null.has_reagent() runtimes caused by on_mob_life procs.

Rob Nelson requested to merge pull/7632/hotfix-chem-holder-null-ref into Bleeding-Edge

Created by: gbasood

Also absolute paths Chemistry-Reagents because I did it anyways when I was trying to get stack dumps working And (doubtfully) fixes a few qdeletions not being properly handled.

Why this happened

during /datum/reagent/proc/on_mob_life, some procs are called which can result in the reagent's deletion er qdel'tion anyway but even if that occurs the reagent keeps on processing it's overriden proc for example, dexalin it's on_mob_life calls it's parent on_mob_life. when its volume is <0.1 it gets qdel'd in there. and then it continues with its own custom on_mob_life which also explains why each reagent only runtimes once because it's been properly removed from the reagents list and isn't called again on the next loop through

Or, put another way:

  • dexalin's on_mob_life is called
  • it calls ..() (/datum/reagent/proc/on_mob_life())
  • somewhere in there it checks the reagent's volume. if that volume < 0.1 it qdel's the reagent.
  • the ..() call continues. it does not check if the holder still exists before the proc ends.
  • execution re-enters the overriden dexalin on_mob_life() proc
  • it tries to access its holder var, which is now nulled out because Destroy() has been called on it
  • RUNTIME

What I did:

In /datum/reagents/proc/on_mob_life(), it now checks if the reagent's holder var is anything other than null before continuing processing. If it is null, it returns 1. All the overriden on_mob_life()'s (that I checked) checked if ..() returned 1 and then stopped processing before continuing. So it never gets to the part that it was runtiming at before.

Merge request reports