Null check the Item in the supplied stack as well as the stack itself.

This commit is contained in:
Christian 2014-06-22 14:47:24 -04:00
parent 4778c33902
commit 1275aa732e
1 changed files with 7 additions and 7 deletions

View File

@ -295,7 +295,7 @@ public class OreDictionary
@Deprecated // Use getOreIds below for more accuracy
public static int getOreID(ItemStack stack)
{
if (stack == null) return -1;
if (stack == null || stack.getItem() == null) return -1;
int id = Item.getIdFromItem(stack.getItem());
List<Integer> ids = stackToId.get(id); //Try the wildcard first
@ -315,7 +315,7 @@ public class OreDictionary
*/
public static int[] getOreIDs(ItemStack stack)
{
if (stack == null) return new int[0];
if (stack == null || stack.getItem() == null) return new int[0];
Set<Integer> set = new HashSet<Integer>();