Skip to content

Commit

Permalink
Fix potential NPE from null EntityPlayer passed through CraftingInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
Rongmario committed Dec 13, 2023
1 parent 0bdccde commit ff44b08
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class CraftingInfo {
public CraftingInfo(InventoryCrafting inventory, @UnknownNullability EntityPlayer player) {
this.inventory = inventory;
this.player = player;
this.world = player.world;
this.world = player == null ? null : player.world;
}

public InventoryCrafting getInventory() {
Expand All @@ -26,7 +26,10 @@ public EntityPlayer getPlayer() {
}

public int getDimension() {
return this.world.provider.getDimension();
if (this.world != null) {
return this.world.provider.getDimension();
}
return 0;
}

public World getWorld() {
Expand Down

0 comments on commit ff44b08

Please sign in to comment.