Skip to content

Commit

Permalink
fix crash if no saved data
Browse files Browse the repository at this point in the history
  • Loading branch information
LupaDevStudio committed Jan 3, 2024
1 parent a57ffe1 commit 40a22f9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tools/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@

NUMBER_ADS_CREDITS = 1


class UserData():
"""
A class to store the user data.
Expand All @@ -112,8 +113,8 @@ def __init__(self) -> None:
self.saved_data = None
else:
self.saved_data = data["saved_data"]
if not "credit" in self.saved_data:
self.saved_data["credit"] = NUMBER_ADS_CREDITS
if self.saved_data is not None and not "credit" in self.saved_data:
self.saved_data["credit"] = NUMBER_ADS_CREDITS

def save_changes(self) -> None:
"""
Expand Down

0 comments on commit 40a22f9

Please sign in to comment.