Skip to content

Commit

Permalink
🐛 Catch non-numeric skill values (+PB)
Browse files Browse the repository at this point in the history
  • Loading branch information
ebullient committed Oct 10, 2023
1 parent 4c26284 commit 6197f64
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main/java/dev/ebullient/convert/qute/QuteUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,16 @@ default void addIntegerUnlessEmpty(Map<String, Object> map, String key, Integer
/** Remove leading '+' */
default Map<String, Integer> mapOfNumbers(Map<String, String> map) {
Map<String, Integer> result = new HashMap<>();
map.forEach((k, v) -> result.put(k, Integer.parseInt(v)));

for (Map.Entry<String, String> entry : map.entrySet()) {
int intVal = 0;
try {
intVal = Integer.parseInt(entry.getValue());
} catch (NumberFormatException e) {
// ignore
}
result.put(entry.getKey(), intVal);
}
return result;
}

Expand Down

0 comments on commit 6197f64

Please sign in to comment.