# HG changeset patch # User Björn Ricks # Date 1306325545 -7200 # Node ID 07394c6155e2b81a2a32b8c34090d35145176307 # Parent fa53e2ec484dc13cef7ef6081afeb5a3afba2017 Don't crash if subtracted time is greater then the current time Fixes #1569 diff -r fa53e2ec484d -r 07394c6155e2 getan/states.py --- a/getan/states.py Wed May 25 13:42:41 2011 +0200 +++ b/getan/states.py Wed May 25 14:12:25 2011 +0200 @@ -283,9 +283,13 @@ class SubtractTimeState(BaseTimeState): def enter(self): minutes = safe_int(self.view.frame.get_footer().get_edit_text()) + sec = minutes * 60 + if sec > self.state.sec: + self.view._total_time() + return self.state project = self.view.item_in_focus() project.start += timedelta(minutes=minutes) - self.state.sec -= minutes * 60 + self.state.sec -= sec logger.info("SubtractTimeState: subtract %d minutes from project '%s'" % (minutes, project.desc)) self.view._total_time()