Fixed NPE when breaking placed Herbalism blocks.

This commit is contained in:
GJ 2012-03-10 15:43:48 -05:00
parent ce8ddded92
commit 989f12e65b

View File

@ -106,6 +106,7 @@ public class Herbalism {
int herbLevel = PP.getSkillLevel(SkillType.HERBALISM); int herbLevel = PP.getSkillLevel(SkillType.HERBALISM);
int id = block.getTypeId(); int id = block.getTypeId();
Material type = block.getType(); Material type = block.getType();
Byte data = block.getData(); Byte data = block.getData();
Location loc = block.getLocation(); Location loc = block.getLocation();
Material mat = null; Material mat = null;
@ -208,6 +209,10 @@ public class Herbalism {
break; break;
} }
if (mat == null) {
return;
}
else {
ItemStack is = new ItemStack(mat); ItemStack is = new ItemStack(mat);
if (herbLevel > 1000 || (Math.random() * 1000 <= herbLevel)) { if (herbLevel > 1000 || (Math.random() * 1000 <= herbLevel)) {
@ -233,6 +238,7 @@ public class Herbalism {
PP.addXP(SkillType.HERBALISM, xp, player); PP.addXP(SkillType.HERBALISM, xp, player);
Skills.XpCheckSkill(SkillType.HERBALISM, player); Skills.XpCheckSkill(SkillType.HERBALISM, player);
} }
}
/** /**
* Apply the Green Thumb ability. * Apply the Green Thumb ability.