[geary: 35/66] GC vacuum: verify non-null services



commit f5279c6533f345dcfb0f8dadbaa13e1861616d9f
Author: Chris Heywood <15127-creywood users noreply gitlab gnome org>
Date:   Fri Jan 10 10:59:40 2020 +0100

    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.

 src/engine/imap-db/imap-db-database.vala | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/engine/imap-db/imap-db-database.vala b/src/engine/imap-db/imap-db-database.vala
index c45054e02..3ee241938 100644
--- a/src/engine/imap-db/imap-db-database.vala
+++ b/src/engine/imap-db/imap-db-database.vala
@@ -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");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]