Skip to content

Commit

Permalink
Fix NPE with new mercy min attribute (#1093)
Browse files Browse the repository at this point in the history
Signed-off-by: Pablete1234 <[email protected]>
  • Loading branch information
Pablete1234 authored Nov 4, 2022
1 parent db10316 commit ad78001
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions core/src/main/java/tc/oc/pgm/score/ScoreModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,13 @@ public ScoreModule parse(MapFactory factory, Logger logger, Document doc)

for (Element scoreEl : scoreElements) {
config.scoreLimit = XMLUtils.parseNumber(scoreEl.getChild("limit"), Integer.class, -1);
config.mercyLimit = XMLUtils.parseNumber(scoreEl.getChild("mercy"), Integer.class, -1);

Element mercyElement = XMLUtils.getUniqueChild(scoreEl, "mercy");
config.mercyLimitMin =
XMLUtils.parseNumber(Node.fromAttr(mercyElement, "min"), Integer.class, -1);
Element mercyEl = XMLUtils.getUniqueChild(scoreEl, "mercy");
if (mercyEl != null) {
config.mercyLimit = XMLUtils.parseNumber(mercyEl, Integer.class, -1);
config.mercyLimitMin =
XMLUtils.parseNumber(Node.fromAttr(mercyEl, "min"), Integer.class, -1);
}

// For backwards compatibility, default kill/death points to 1 if proto is old and <king/>
// tag
Expand Down

0 comments on commit ad78001

Please sign in to comment.