mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-13 16:54:22 +00:00
Fix possible NPE in findItemStack, closes #218
This commit is contained in:
1 parent
8f35adca7a
commit
b3d4ea05ec
1 file changed
+8
-3
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user