Skip to content

Commit

Permalink
Fix a divide by zero error which could occur after a booster finishes.
Browse files Browse the repository at this point in the history
  • Loading branch information
mgoeppner committed Dec 21, 2022
1 parent 71c4d56 commit 10dfd20
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/EVEMon.Common/Models/SkillQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,14 @@ internal void Dispose()
var remainingSP = i.EndSP - i.CurrentSP;
var expectedSPInActualTime = Math.Round(actualTime.TotalHours * expectedSPRate);

var boosterHours = (remainingSP - expectedSPInActualTime) / (actualSPRate - expectedSPRate);
var spRateDiff = actualSPRate - expectedSPRate;

if (spRateDiff <= 0)
{
return TimeSpan.Zero.TotalHours;
}

var boosterHours = (remainingSP - expectedSPInActualTime) / spRateDiff;

return boosterHours;
}
Expand Down

0 comments on commit 10dfd20

Please sign in to comment.