Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix for BuddyPokemon task #5573

Merged
merged 1 commit into from
Sep 20, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pokemongo_bot/cell_workers/buddy_pokemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ def _validate_config(self):
self.buddy_distance_needed = pokemon.buddy_distance_needed

def work(self):
if not self.enabled:
return WorkerResult.SUCCESS

if self.buddy_list:
if self.force_first_change or not self.buddy or self.candy_limit != 0 and self.candy_awarded >= self.candy_limit:
self.force_first_change = False
Expand All @@ -105,7 +108,7 @@ def work(self):
if pokemon is None:
return WorkerResult.ERROR

if pokemon.name != self._get_pokemon_by_id(self.buddy['id']).name:
if not self.buddy or pokemon.name != self._get_pokemon_by_id(self.buddy['id']).name:
self._set_buddy(pokemon)

if not self.buddy:
Expand Down