From 188672a81b81336c018247f918bde935e3d4b433 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Thu, 28 Feb 2013 19:36:59 +0000 Subject: [PATCH] mac: fix crash in watcher. closes #1190 --- SparkleShare/Mac/SparkleMacWatcher.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/SparkleShare/Mac/SparkleMacWatcher.cs b/SparkleShare/Mac/SparkleMacWatcher.cs index 07b0b08b..305e5449 100755 --- a/SparkleShare/Mac/SparkleMacWatcher.cs +++ b/SparkleShare/Mac/SparkleMacWatcher.cs @@ -151,12 +151,14 @@ namespace SparkleShare { var handler = Changed; if (handler != null) { - string path = paths [0]; - path = path.Substring (Path.Length); - path = path.Trim ("/".ToCharArray ()); + if (paths [0].Length >= Path.Length) { + string path = paths [0]; + path = path.Substring (Path.Length); + path = path.Trim ("/".ToCharArray ()); - if (!string.IsNullOrWhiteSpace (path)) - handler (path); + if (!string.IsNullOrWhiteSpace (path)) + handler (path); + } } GC.KeepAlive (this);