From 434a6e529488053b1164824c1827ec3bca23dd9b Mon Sep 17 00:00:00 2001 From: Joffrey BION Date: Sat, 10 Dec 2016 11:46:08 +0100 Subject: Fix Science.getQuantity(type) NPE when no element of the given type --- src/main/java/org/luxons/sevenwonders/game/boards/Science.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/org/luxons/sevenwonders/game/boards/Science.java b/src/main/java/org/luxons/sevenwonders/game/boards/Science.java index 3b08ce8f..f3d6a681 100644 --- a/src/main/java/org/luxons/sevenwonders/game/boards/Science.java +++ b/src/main/java/org/luxons/sevenwonders/game/boards/Science.java @@ -28,7 +28,11 @@ public class Science { } public int getQuantity(ScienceType type) { - return quantities.get(type); + return quantities.getOrDefault(type, 0); + } + + public int size() { + return quantities.size() + jokers; } public int computePoints() { -- cgit