jptrrs / HumanResources

A technology overhaul for RimWorld
MIT License
17 stars 12 forks source link

Add a Null check for LearningUtility::WeaponTrainingAnimation -> verbToUse #187

Open kyrun opened 2 years ago

kyrun commented 2 years ago

I got a null pointer exception at this function from the debug log, possibly caused by other mod incompatibilities. I don't really know which mod, because as with most people, we all have hundreds of mods. Not sure if it will help but my pawn was training with the vanilla recurve bow so it wasn't a modded weapon. I also have Yayo's animation, that could be part of it.

I downloaded your code and compiled it and added nullchecks on every possible thing in this specific function plus a log message for each catch, and it seems that the parameter "verbToUse" is null.

It fixes the problem I was facing, where the pawn could not train a ranged weapon properly due to the exception stopping it prematurely (I guess it is trying to play some animation). I rather like this mod so I would like my pawns to properly train with the weapons, no animation is fine with me.

I already created a modified dll for my personal use, but would be nice to see this officially addressed. More null checks never hurt anyone. Thanks and keep up the good work.