Fix NPC pickup crash

Thanks to hmmR89 for the spot and fix-suggestion.
Merge pull request #8578 from KA101/crashtest

Fix NPC pickup crash