Skip to content

Commit

Permalink
ban: Wrapped DB queries in try-except clause to avoid tracebacks when…
Browse files Browse the repository at this point in the history
… leaver ban is on.
  • Loading branch information
MinoMino committed Jan 14, 2016
1 parent 753499e commit 849a2a1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions ban.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,13 +359,14 @@ def leave_status(self, steam_id):
if not self.get_cvar("qlx_leaverBan", bool):
return None

completed = self.db[PLAYER_KEY.format(steam_id) + ":games_completed"]
left = self.db[PLAYER_KEY.format(steam_id) + ":games_left"]
if completed is None or left is None:
try:
completed = self.db[PLAYER_KEY.format(steam_id) + ":games_completed"]
left = self.db[PLAYER_KEY.format(steam_id) + ":games_left"]
except KeyError:
return None
else:
completed = int(completed)
left = int(left)

completed = int(completed)
left = int(left)

min_games_completed = self.get_cvar("qlx_leaverBanMinimumGames", int)
warn_threshold = self.get_cvar("qlx_leaverBanWarnThreshold", float)
Expand Down

0 comments on commit 849a2a1

Please sign in to comment.