Fix possible NPE in findItemStack, closes #218

This commit is contained in:
Christian 2013-04-17 07:55:33 -04:00
parent 3d142df102
commit e204d580a8

View file

@ -421,8 +421,13 @@ public class GameRegistry
*/ */
public static ItemStack findItemStack(String modId, String name, int stackSize) public static ItemStack findItemStack(String modId, String name, int stackSize)
{ {
ItemStack is = GameData.findItemStack(modId, name).func_77946_l(); ItemStack foundStack = GameData.findItemStack(modId, name);
is.field_77994_a = Math.min(stackSize, is.func_77976_d()); if (foundStack != null)
return is; {
ItemStack is = foundStack.func_77946_l();
is.field_77994_a = Math.min(stackSize, is.func_77976_d());
return is;
}
return null;
} }
} }