Skip to content

Commit

Permalink
Null-safety fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SyberiaK committed Jan 12, 2024
1 parent 0ef8a52 commit 2580bd1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions collectors/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ async def unique_monthly():
with open(config.CACHE_FILE_PATH, encoding='utf-8') as f:
cache = json.load(f)

if cache.get('monthly_unique_players') is None:
cache['monthly_unique_players'] = data

if data != cache.get('monthly_unique_players'):
await send_alert('monthly_unique_players',
(cache['monthly_unique_players'], data))
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ async def profile_info(client: BClient, session: UserSession, callback_query: Ca
with open(config.CACHE_FILE_PATH, encoding='utf-8') as f:
cache_file = json.load(f)

if cache_file['webapi'] != 'normal':
if cache_file.get('webapi') != 'normal':
return await send_about_maintenance(client, session, callback_query)

await callback_query.edit_message_text(session.locale.bot_choose_cmd,
Expand Down

0 comments on commit 2580bd1

Please sign in to comment.