Skip to content

Commit

Permalink
Fixes #5883 (#5884)
Browse files Browse the repository at this point in the history
This fixes an issue when you have a brand new account (no stardust yet)
and run the bot. This makes sure the key is there before we do something
with it.
  • Loading branch information
davidakachaos authored and solderzzc committed Jan 23, 2017
1 parent ce54971 commit 55e2654
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pokemongo_bot/__init__.py
Expand Up @@ -72,11 +72,17 @@ def player_data(self):

@property
def stardust(self):
return filter(lambda y: y['name'] == 'STARDUST', self._player['currencies'])[0]['amount']
dust = filter(lambda y: y['name'] == 'STARDUST', self._player['currencies'])[0]
if 'amount' in dust:
return dust['amount']
else:
return 0

@stardust.setter
def stardust(self, value):
filter(lambda y: y['name'] == 'STARDUST', self._player['currencies'])[0]['amount'] = value
dust = filter(lambda y: y['name'] == 'STARDUST', self._player['currencies'])[0]
if 'amount' in dust:
dust['amount'] = value

def __init__(self, db, config):

Expand Down

0 comments on commit 55e2654

Please sign in to comment.