Check if NBT is null before processing it. Fixes #1362