Skip to content

Commit c7fb964

Browse files
committed
fixed a bug where the button "-1 Min" crashed the program when there were already 0 minutes in the current saved hour
1 parent 99df4c8 commit c7fb964

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

WorktimeSummary/utilities/Time.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,18 @@ private void NormalizeTime()
118118
int h = Hours;
119119
Hours += Minutes / 60;
120120
Minutes -= (Hours - h) * 60;
121+
122+
if (Seconds < 0)
123+
{
124+
Seconds = 60 - Seconds;
125+
Minutes -= Seconds / 60;
126+
Hours -= Minutes / 60;
127+
}
128+
if (Minutes < 0)
129+
{
130+
Minutes = 60 + Minutes;
131+
Hours -= (Minutes / 60) + 1;
132+
}
121133
}
122134

123135
public override string ToString()

0 commit comments

Comments
 (0)