Skip to content

Commit

Permalink
Mitigated timspan overflow exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Asnivor committed May 3, 2018
1 parent 1e3d9e8 commit df21db4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
3 changes: 2 additions & 1 deletion BuildTools/ChangeLog/default.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ title: Changelog
------------------------------------
#### Development Build Changes ([Dev](https://github.com/Asnivor/MedLaunch/tree/dev) branch) - [![Build status](https://ci.appveyor.com/api/projects/status/4maii9la7yb72bw8/branch/dev?svg=true)](https://ci.appveyor.com/project/Asnivor/medlaunch/branch/dev/artifacts)
------------------------------------
* (Enhancement) - Added compatibility for mednafen v1.21.2 and v1.21.3
* (Enhancement) - Added compatibility for mednafen v1.21.2 and v1.21.3 ([214](https://github.com/Asnivor/MedLaunch/issues/214))
* (BugFix) - Mitigated TimeSpan overflow exception ([215](https://github.com/Asnivor/MedLaunch/issues/215))

##### [0.5.25.3](https://medlaunch.info/releases/0-5-25-x)
###### 2018-03-22
Expand Down
34 changes: 21 additions & 13 deletions MedLaunch/Classes/VisualHandlers/GamesLibraryVisualHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1032,21 +1032,29 @@ public static string GetDatetimeDifference(DateTime older, DateTime newer)
public static string FormatMinutesToString(double minutes)
{
string tt = "";
TimeSpan ts = TimeSpan.FromMinutes(minutes);
int hh = ts.Hours;
int mm = ts.Minutes;
int ss = ts.Seconds;
if (minutes <= 0)
tt = "Never";
else
try
{
TimeSpan ts = TimeSpan.FromMinutes(minutes);
int hh = ts.Hours;
int mm = ts.Minutes;
int ss = ts.Seconds;
if (minutes <= 0)
tt = "Never";
else
{
if (hh > 0)
tt += hh + " Hours, ";
if (mm > 0)
tt += mm + " Minutes, ";
tt += ss + " Seconds";
}

return tt;
}
catch (Exception)
{
if (hh > 0)
tt += hh + " Hours, ";
if (mm > 0)
tt += mm + " Minutes, ";
tt += ss + " Seconds";
return "Unknown";
}
return tt;
}

// Get the current setup of the games library (selected filters etc), do a refresh then return to previous configuration
Expand Down

0 comments on commit df21db4

Please sign in to comment.