Replace most T.Parse with T.TryParse for all user input.

This commit is contained in:
hondacrx
2017-11-05 15:21:29 -05:00
parent 8c863de8a6
commit 8ed446ae7a
40 changed files with 477 additions and 527 deletions
+2 -2
View File
@@ -884,8 +884,8 @@ namespace Google.Protobuf
if (subseconds != "")
{
// This should always work, as we've got 1-9 digits.
int parsedFraction = int.Parse(subseconds.Substring(1));
nanos = parsedFraction * SubsecondScalingFactors[subseconds.Length] * multiplier;
if (int.TryParse(subseconds.Substring(1), out int parsedFraction))
nanos = parsedFraction * SubsecondScalingFactors[subseconds.Length] * multiplier;
}
if (!Duration.IsNormalized(seconds, nanos))
{