From 37ec3e4df9ca201667f884355bc29d1cfb827244 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 12 Nov 2011 02:05:33 +0000 Subject: [PATCH] controller: Catch harmless FileNotFoundException that sometimes happens even if the file exists. Fixes #408 --- SparkleShare/SparkleControllerBase.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index 38be86bd..3d89e086 100755 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -928,8 +928,17 @@ namespace SparkleShare { // Delete avatars older than a month if (avatar_info.CreationTime < DateTime.Now.AddMonths (-1)) { - avatar_info.Delete (); - old_avatars.Add (email); + try { + avatar_info.Delete (); + old_avatars.Add (email); + + } catch (FileNotFoundException) { + // FIXME: For some reason the previous File.Exists () check + // doesn't cover all cases sometimes, so we catch any errors + + if (old_avatars.Contains (email)) + old_avatars.Remove (email); + } } } else {