controller: Catch harmless FileNotFoundException that sometimes happens even if the file exists. Fixes #408
This commit is contained in:
parent
76a24f9af3
commit
37ec3e4df9
|
@ -928,8 +928,17 @@ namespace SparkleShare {
|
||||||
|
|
||||||
// Delete avatars older than a month
|
// Delete avatars older than a month
|
||||||
if (avatar_info.CreationTime < DateTime.Now.AddMonths (-1)) {
|
if (avatar_info.CreationTime < DateTime.Now.AddMonths (-1)) {
|
||||||
|
try {
|
||||||
avatar_info.Delete ();
|
avatar_info.Delete ();
|
||||||
old_avatars.Add (email);
|
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 {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue