[SPIGOT-4302] Setting an item in an unplaced furnace results in a NullPointerException Created: 22/Aug/18 Updated: 26/Aug/18 Resolved: 26/Aug/18 |
|
Status: | Resolved |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | Pieter12345 | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 0 |
Labels: | exception, furnace, inventory |
Version: | git-Bukkit-ec86574 (MC: 1.13) |
Guidelines Read: | Yes |
Description |
When setting an item in the inventory of an unplaced furnace, a NullPointerException is thrown due to the world being null.
This exception is throws in method `s()` on line: in the NMS.TileEntityFurnace class, due to `this.world` being null. This exception triggers at least on line `this.cookTimeTotal = this.s();` call in the `setItem(int, ItemStack)` method in the NMS.TileEntityFurnace class, which is called when setting an item through the Bukkit/Spigot API.
Reproduce code: org.bukkit.block.Furnace furnace = (org.bukkit.block.Furnace) ((org.bukkit.inventory.meta.BlockStateMeta) new org.bukkit.inventory.ItemStack(org.bukkit.Material.FURNACE).getItemMeta()).getBlockState();
Proposed solution: |
Comments |
Comment by Pieter12345 [ 26/Aug/18 ] |
Sorry for that, I used groovy to execute that code and the groovy interpreter does not require casts. I've added the missing cast. |
Comment by md_5 [ 26/Aug/18 ] |
FYI that code doesn't even compile. |
Comment by Pieter12345 [ 26/Aug/18 ] |
Added reproduction code. |
Comment by md_5 [ 22/Aug/18 ] |
No code |