From 60273631f36320b31b0e6248d86e36d24cbbef28 Mon Sep 17 00:00:00 2001 From: wimh Date: Sun, 21 Aug 2011 01:18:03 +0200 Subject: [PATCH] avoid crash if remote folder is deleted by user. When all files including the .git folder are removed from a remote folder, but that folder is not removed from the SparkleShare config, SparkleShare crashes at startup, and when showing the log for that folder. This commit should avoid a crash. --- SparkleLib/Git/SparkleRepoGit.cs | 3 +++ SparkleShare/SparkleEventLog.cs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/SparkleLib/Git/SparkleRepoGit.cs b/SparkleLib/Git/SparkleRepoGit.cs index a81fad71..4e9b582c 100644 --- a/SparkleLib/Git/SparkleRepoGit.cs +++ b/SparkleLib/Git/SparkleRepoGit.cs @@ -45,6 +45,9 @@ namespace SparkleLib { string output = git.StandardOutput.ReadToEnd (); git.WaitForExit (); + if (output.Length < 40) + return null; + return output.Substring (0, 40); } } diff --git a/SparkleShare/SparkleEventLog.cs b/SparkleShare/SparkleEventLog.cs index 5d73998a..73901de1 100644 --- a/SparkleShare/SparkleEventLog.cs +++ b/SparkleShare/SparkleEventLog.cs @@ -203,6 +203,9 @@ namespace SparkleShare { if (html == null) html = Controller.HTML; + if (html == null) + return; + html = html.Replace ("", (double) (Style.FontDescription.Size / 1024 + 3) + "px"); html = html.Replace ("", (Style.FontDescription.Size / 1024 + 3) + "px"); html = html.Replace ("", "#0085cf");