Skip to content

Commit 6bf01f6

Browse files
authored
Merge pull request #225 from vmarchaud/Development
Fix for a NPE in CandyJar + fix checkstyle
2 parents 82cd09f + efc490f commit 6bf01f6

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/main/java/com/pokegoapi/api/inventory/CandyJar.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ public void removeCandy(PokemonFamilyId family, int amount) {
8181
* @return number of candies in jar
8282
*/
8383
public int getCandies(PokemonFamilyId family) {
84-
return this.candies.get(family);
84+
if (candies.containsKey(family)) {
85+
return this.candies.get(family);
86+
} else {
87+
return 0;
88+
}
8589
}
8690
}

src/main/java/com/pokegoapi/api/pokemon/Pokemon.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ public int getIndividualStamina() {
272272
* Calculates the pokemons IV ratio.
273273
* @return the pokemons IV ratio as a double between 0 and 1.0, 1.0 being perfect IVs
274274
*/
275-
public double getIVRatio() {
275+
public double getIvRatio() {
276276
return (this.getIndividualAttack() + this.getIndividualDefense() + this.getIndividualStamina()) / 45.0;
277277
}
278278

0 commit comments

Comments
 (0)