From 5b43da10125e2f6338a328ebe95200d5015938eb Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sun, 27 Jan 2013 11:47:48 +0000 Subject: [PATCH] repo git: catch exceptions when parsing sync speed. fixes #1163 --- SparkleLib/Git/SparkleRepoGit.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/SparkleLib/Git/SparkleRepoGit.cs b/SparkleLib/Git/SparkleRepoGit.cs index 43d8705d..947165fe 100644 --- a/SparkleLib/Git/SparkleRepoGit.cs +++ b/SparkleLib/Git/SparkleRepoGit.cs @@ -280,7 +280,11 @@ namespace SparkleLib.Git { Match speed_match = this.speed_regex.Match (line); if (speed_match.Success) { - speed = double.Parse (speed_match.Groups [1].Value, new CultureInfo ("en-US")) * 1024; + try { + speed = double.Parse (speed_match.Groups [1].Value, new CultureInfo ("en-US")) * 1024; + + } catch (FormatException) { + } if (speed_match.Groups [2].Value.Equals ("M")) speed = speed * 1024; @@ -362,7 +366,11 @@ namespace SparkleLib.Git { Match speed_match = this.speed_regex.Match (line); if (speed_match.Success) { - speed = double.Parse (speed_match.Groups [1].Value, new CultureInfo ("en-US")) * 1024; + try { + speed = double.Parse (speed_match.Groups [1].Value, new CultureInfo ("en-US")) * 1024; + + } catch (FormatException) { + } if (speed_match.Groups [2].Value.Equals ("M")) speed = speed * 1024;