Skip to content

Commit d3c87dd

Browse files
committed
null pointer fix
1 parent 4f5b715 commit d3c87dd

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public void updateInventories(boolean forceUpdate) throws LoginFailedException,
106106
InventoryItemDataOuterClass.InventoryItemData itemData = inventoryItem.getInventoryItemData();
107107

108108
if (itemData.getPokemonData().getPokemonId() != PokemonIdOuterClass.PokemonId.MISSINGNO) {
109-
pokebank.addPokemon(new Pokemon(inventoryItem.getInventoryItemData().getPokemonData()));
109+
pokebank.addPokemon(new Pokemon(api, inventoryItem.getInventoryItemData().getPokemonData()));
110110
}
111111
if (itemData.getItem().getItemId() != ItemId.UNRECOGNIZED
112112
&& itemData.getItem().getItemId() != ItemId.ITEM_UNKNOWN) {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@
4444
public class Pokemon {
4545

4646
private static final String TAG = Pokemon.class.getSimpleName();
47-
@Setter
48-
PokemonGo pgo;
47+
private final PokemonGo pgo;
4948
private PokemonData proto;
5049

5150
// API METHODS //
5251

5352
// DELEGATE METHODS BELOW //
54-
public Pokemon(PokemonData proto) {
53+
public Pokemon(PokemonGo api, PokemonData proto) {
54+
this.pgo = api;
5555
this.proto = proto;
5656
}
5757

0 commit comments

Comments
 (0)