Fix potential NPE in ForgeHooks.onItemPlaceIntoWorld when passing in null player. (#7505)

This commit is contained in:
Alex O'Neill 2020-12-28 15:18:52 -05:00 committed by GitHub
parent 545723dc8c
commit a1119cd77a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -674,7 +674,8 @@ public class ForgeHooks
world.markAndNotifyBlock(snap.getPos(), world.getChunkAt(snap.getPos()), oldBlock, newBlock, updateFlag, 512);
}
player.addStat(Stats.ITEM_USED.get(item));
if (player != null)
player.addStat(Stats.ITEM_USED.get(item));
}
}
world.capturedBlockSnapshots.clear();