From 991620175fbeee38b0bcb29a62b7f316ea8e986e Mon Sep 17 00:00:00 2001 From: mjmfighter Date: Fri, 22 Jul 2016 21:21:10 -0500 Subject: [PATCH] null pointer fix --- src/main/java/com/pokegoapi/api/inventory/Inventories.java | 2 +- src/main/java/com/pokegoapi/api/pokemon/Pokemon.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/pokegoapi/api/inventory/Inventories.java b/src/main/java/com/pokegoapi/api/inventory/Inventories.java index ab41960f..2918dee2 100644 --- a/src/main/java/com/pokegoapi/api/inventory/Inventories.java +++ b/src/main/java/com/pokegoapi/api/inventory/Inventories.java @@ -125,7 +125,7 @@ public void updateInventories(boolean forceUpdate) throws LoginFailedException, // pokebank if (itemData.getPokemonData().getPokemonId() != PokemonId.MISSINGNO) { - pokebank.addPokemon(new Pokemon(inventoryItem.getInventoryItemData().getPokemonData())); + pokebank.addPokemon(new Pokemon(api, inventoryItem.getInventoryItemData().getPokemonData())); } // items diff --git a/src/main/java/com/pokegoapi/api/pokemon/Pokemon.java b/src/main/java/com/pokegoapi/api/pokemon/Pokemon.java index b9591eef..fcc4f457 100644 --- a/src/main/java/com/pokegoapi/api/pokemon/Pokemon.java +++ b/src/main/java/com/pokegoapi/api/pokemon/Pokemon.java @@ -44,14 +44,14 @@ public class Pokemon { private static final String TAG = Pokemon.class.getSimpleName(); - @Setter - PokemonGo pgo; + private final PokemonGo pgo; private PokemonData proto; // API METHODS // // DELEGATE METHODS BELOW // - public Pokemon(PokemonData proto) { + public Pokemon(PokemonGo api, PokemonData proto) { + this.pgo = api; this.proto = proto; }