Fix possible NPE in findItemStack, closes #218
This commit is contained in:
parent
3d142df102
commit
e204d580a8
1 changed files with 8 additions and 3 deletions
|
@ -421,8 +421,13 @@ public class GameRegistry
|
|||
*/
|
||||
public static ItemStack findItemStack(String modId, String name, int stackSize)
|
||||
{
|
||||
ItemStack is = GameData.findItemStack(modId, name).func_77946_l();
|
||||
is.field_77994_a = Math.min(stackSize, is.func_77976_d());
|
||||
return is;
|
||||
ItemStack foundStack = GameData.findItemStack(modId, name);
|
||||
if (foundStack != null)
|
||||
{
|
||||
ItemStack is = foundStack.func_77946_l();
|
||||
is.field_77994_a = Math.min(stackSize, is.func_77976_d());
|
||||
return is;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue