Skip to content

Commit

Permalink
Handle NumberFormatException
Browse files Browse the repository at this point in the history
  • Loading branch information
ljfa-ag committed Mar 26, 2015
1 parent 17f0881 commit a900b7a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/java/ljfa/tntutils/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,13 @@ public static void modifyResistances() {
if(block == Blocks.air || block == null)
throw new InvalidConfigValueException("blockResistances: Invalid block name: " + blockName);

float resist = Float.parseFloat(valueStr);
block.setResistance(resist);
LogHelper.debug("Changed resistance of %s to %g", blockName, resist);
try {
float resist = Float.parseFloat(valueStr);
block.setResistance(resist);
LogHelper.debug("Changed resistance of %s to %g", blockName, resist);
} catch(NumberFormatException ex) {
throw new InvalidConfigValueException("blockResistances: Invalid number format", ex);
}
}
}

Expand Down

0 comments on commit a900b7a

Please sign in to comment.