Fix NPC pickup crash

Fixes #8573.  Thanks to hmmR89 for the spot and fix-suggestion.