Skip to content

Commit

Permalink
Merge pull request #145 from Yutsuten/fix-history
Browse files Browse the repository at this point in the history
Prevent undo error in some edge cases
  • Loading branch information
Yutsuten authored Aug 12, 2022
2 parents 6556ffd + 48417cb commit 0b0e53e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/deck_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ def undo(self):
"""Restore the life to how it was in the previous card."""
bar_info = self._bar_info[self._cur_deck_id]
history = bar_info['history']
if bar_info['currentReview'] == 0:
return
bar_info['currentReview'] -= 1
bar_info['currentValue'] = history[bar_info['currentReview']]
self._progress_bar.set_current_value(bar_info['currentValue'])
Expand Down

0 comments on commit 0b0e53e

Please sign in to comment.