summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorJoffrey BION <joffrey.bion@gmail.com>2016-12-10 11:46:08 +0100
committerJoffrey BION <joffrey.bion@gmail.com>2016-12-10 11:46:08 +0100
commit434a6e529488053b1164824c1827ec3bca23dd9b (patch)
tree3dd1f5526e9f3385608be0ecaa8783827c29ccd2 /src/main
parentAdd multiple effects support for cards (diff)
downloadseven-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')
-rw-r--r--src/main/java/org/luxons/sevenwonders/game/boards/Science.java6
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() {
bgstack15