diff options
author | Joffrey BION <joffrey.bion@gmail.com> | 2016-12-10 11:46:08 +0100 |
---|---|---|
committer | Joffrey BION <joffrey.bion@gmail.com> | 2016-12-10 11:46:08 +0100 |
commit | 434a6e529488053b1164824c1827ec3bca23dd9b (patch) | |
tree | 3dd1f5526e9f3385608be0ecaa8783827c29ccd2 /src/main/java/org/luxons | |
parent | Add multiple effects support for cards (diff) | |
download | seven-wonders-434a6e529488053b1164824c1827ec3bca23dd9b.tar.gz seven-wonders-434a6e529488053b1164824c1827ec3bca23dd9b.tar.bz2 seven-wonders-434a6e529488053b1164824c1827ec3bca23dd9b.zip |
Fix Science.getQuantity(type) NPE when no element of the given type
Diffstat (limited to 'src/main/java/org/luxons')
-rw-r--r-- | src/main/java/org/luxons/sevenwonders/game/boards/Science.java | 6 |
1 files changed, 5 insertions, 1 deletions
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() { |