Permalink
Browse files

Handle NumberFormatExceptions.

  • Loading branch information...
1 parent 920f6d4 commit 93c05aa906704e0b6f9f09968824e1da602f1ae1 @Raptor399 Raptor399 committed Mar 23, 2013
Showing with 10 additions and 2 deletions.
  1. +10 −2 src/main/java/net/pms/encoders/MEncoderVideo.java
View
12 src/main/java/net/pms/encoders/MEncoderVideo.java
@@ -1006,7 +1006,11 @@ public String executable() {
int bitrates[] = new int[2];
if (bitrate.contains("(") && bitrate.contains(")")) {
- bitrates[1] = Integer.parseInt(bitrate.substring(bitrate.indexOf("(") + 1, bitrate.indexOf(")")));
+ try {
+ bitrates[1] = Integer.parseInt(bitrate.substring(bitrate.indexOf("(") + 1, bitrate.indexOf(")")));
+ } catch (NumberFormatException e) {
+ bitrates[1] = 0;
+ }
}
if (bitrate.contains("(")) {
@@ -1017,7 +1021,11 @@ public String executable() {
bitrate = "0";
}
- bitrates[0] = (int) Double.parseDouble(bitrate);
+ try {
+ bitrates[0] = (int) Double.parseDouble(bitrate);
+ } catch (NumberFormatException e) {
+ bitrates[0] = 0;
+ }
return bitrates;
}

0 comments on commit 93c05aa

Please sign in to comment.