Track body wetness [WIP] [CR]

Here is my attempt at storing body wetness in its own entity and not in the morale. Unfortunately, I have done something silly and I get a crash. I am hoping it's something obvious, but breakpoints don't work for me in C::B.
Do I not understand the code or is body_wetness an array? This is checking if it's null, correct? Because on line 774 it is indexed into.