Skip to content

Commit

Permalink
Hotfix - Client crashes when not having a buddy pokemon selected in t…
Browse files Browse the repository at this point in the history
…ask BuddyPokemon (#5789)

* Hotfix to crash when not having a buddy pokemon selected

* Hotfix on Buddy Pokemon task
  • Loading branch information
pablossp authored and solderzzc committed Nov 8, 2016
1 parent 7a56de0 commit c45f4ac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pokemongo_bot/cell_workers/buddy_pokemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def work(self):
return WorkerResult.SUCCESS

if self.buddy_list:
pokemon = self._get_pokemon_by_name(self._get_pokemon_by_id(self.buddy['id']).name)
pokemon = self._get_pokemon_by_name(self._get_pokemon_by_id(self.buddy['id']).name) if 'id' in self.buddy else None
if self.force_first_change or not self.buddy or pokemon is None or (self.candy_limit != 0 and self.candy_awarded >= self.candy_limit) or self._check_candy_limit_absolute(pokemon):
self.force_first_change = False

Expand Down Expand Up @@ -221,7 +221,7 @@ def _check_candy_limit_absolute(self, pokemon):
return self.candy_limit_absolute != 0 and inventory.candies().get(pokemon.family_id).quantity >= self.candy_limit_absolute

def _check_old_reward(self):
if not self.buddy:
if not self.buddy or 'last_km_awarded' not in self.buddy:
return
km_diff = self._km_walked() - self.buddy['last_km_awarded']
rewards_size = km_diff // self.buddy_distance_needed
Expand Down

0 comments on commit c45f4ac

Please sign in to comment.