controller: Catch harmless FileNotFoundException that sometimes happens even if the file exists. Fixes #408

This commit is contained in:
Hylke Bons 2011-11-12 02:05:33 +00:00
parent 76a24f9af3
commit 37ec3e4df9

View file

@ -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 {