Skip to content
This repository has been archived by the owner on Nov 8, 2020. It is now read-only.

Commit

Permalink
Merge pull request #47 from AlexanderDzhoganov/master
Browse files Browse the repository at this point in the history
Fixed a possible uncaught exception in Version.cs
  • Loading branch information
AlexanderDzhoganov committed Jan 5, 2015
2 parents 35a6fc3 + 50950ee commit 1e43da8
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Types/Version.cs
Expand Up @@ -198,8 +198,18 @@ internal static Comparison NumComp(string v1, string v2)
minimumLength2++;
}

int integer1 = int.Parse(v1.Substring(0, minimumLength1));
int integer2 = int.Parse(v2.Substring(0, minimumLength2));
int integer1;
int integer2;

if (!int.TryParse(v1.Substring(0, minimumLength1), out integer1))
{
integer1 = 0;
}

if (!int.TryParse(v2.Substring(0, minimumLength2), out integer2))
{
integer2 = 0;
}

comp.compare_to = integer1.CompareTo(integer2);
return comp;
Expand Down

0 comments on commit 1e43da8

Please sign in to comment.