GC vacuum: verify non-null services

Check IMAP and SMTP aren't null before stopping and starting, although
this should never occur anymore as we don't vacuum at startup.
This commit is contained in:
Chris Heywood 2020-01-10 10:59:40 +01:00
parent 47a5fbcd2f
commit f5279c6533

View file

@ -117,8 +117,10 @@ private class Geary.ImapDB.Database : Geary.Db.VersionedDatabase {
if ((recommended & GC.RecommendedOperation.VACUUM) != 0) {
if (allow_vacuum) {
this.want_background_vacuum = false;
yield account.imap.stop(gc_cancellable);
yield account.smtp.stop(gc_cancellable);
if (account.imap != null)
yield account.imap.stop(gc_cancellable);
if (account.smtp != null)
yield account.smtp.stop(gc_cancellable);
if (!vacuum_monitor.is_in_progress)
vacuum_monitor.notify_start();
@ -135,8 +137,10 @@ private class Geary.ImapDB.Database : Geary.Db.VersionedDatabase {
vacuum_monitor.notify_finish();
}
yield account.imap.start(gc_cancellable);
yield account.smtp.start(gc_cancellable);
if (account.imap != null)
yield account.imap.start(gc_cancellable);
if (account.smtp != null)
yield account.smtp.start(gc_cancellable);
} else {
// Flag a vacuum to run later when we've been idle in the background
debug("Flagging desire to GC vacuum");