Fix possible NPE

I also added a check for NPC inventory locations when the NPC is in a
chunk that's not loaded.

I'll be honest, I don't know if that works.
Merge pull request #629 from Morphan1/master

I like trains