Skip to content

Commit

Permalink
Bandaid for crash on inventory.add
Browse files Browse the repository at this point in the history
  • Loading branch information
Gobberwart committed Sep 9, 2016
1 parent 455b147 commit 7d78d63
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pokemongo_bot/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,12 @@ def all_with_eggs(self):

def add(self, pokemon):
if pokemon.unique_id <= 0:
raise ValueError("Can't add a pokemon without id")
self.bot.logger.debug("Can't add a pokemon without id")
return
if pokemon.unique_id in self._data:
raise ValueError("Pokemon already present in the inventory")
self.bot.logger.debug("Pokemon already present in the inventory")
return

self._data[pokemon.unique_id] = pokemon

def remove(self, pokemon_unique_id):
Expand Down

0 comments on commit 7d78d63

Please sign in to comment.