[MC-5232] Unnecessary null-check in Item Rendering code Created: 22/Dec/12  Updated: 06/Apr/13  Resolved: 06/Apr/13

Status: Resolved
Project: Minecraft: Java Edition
Component/s: None
Affects Version/s: Minecraft 1.4.6
Fix Version/s: None

Type: Bug
Reporter: Riking (Kane York) Assignee: Unassigned
Resolution: Invalid Votes: 0
Labels: code
Environment:

MCP 725


Confirmation Status: Unconfirmed

 Description   

File: Seargename "RenderItem", Notchname "bce"
Method Signature: a(LEntityItem;IIFFFF)V
At Obfuscated Source File Line 176
At MCP Source File Line 246
Near:
```
GL11.glTranslatef(0.0F, 0.0F, var16 + var17);
if (Block.blocksList[var18.itemID] != null)
{
this.loadTexture("/terrain.png");
}
else
```
Var18 is the item contained in the EntityItem.
There are no bounds-checks on this statement to check if var18.itemID will fit into that array. Even though it seems like this is not crashing the game yet, it's possible that that statement could generate an ArrayIndexOutOfBounds exception in certain cases, like a 4096-block fix.

To be honest, I have no clue how this doesn't cause an exception when you drop an item :s

A better way would be to check the item array and do instanceof.



 Comments   
Comment by Tails [ 06/Apr/13 ]

No answer on querry, assuming not an issue anymore.

Comment by Tails [ 17/Mar/13 ]

Is this still a concern in the current Minecraft version? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

Generated at Sun Jan 12 12:07:13 UTC 2025 using Jira 9.12.2#9120002-sha1:301bf498dd45d800842af0b84230f1bb58606c13.