[geary/mjog/986-namespace-assert: 17/22] Geary.Imap.Session: Avoid critical when client session logged out




commit 2093aa32292e11455648d62d8b7a992532aac04e
Author: Michael Gratton <mike vee net>
Date:   Wed Sep 23 08:44:04 2020 +1000

    Geary.Imap.Session: Avoid critical when client session logged out
    
    If the client session is being logging out but some other tasks is
    still attempting to use it, getting a mailbox will assume at least
    one personal namespace exists, but it will have been cleared.
    
    Add a check and throw an exception if none are present, so at least
    it is handled in a well defined way.
    
    Fixes #986

 src/engine/imap/transport/imap-client-session.vala | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/src/engine/imap/transport/imap-client-session.vala 
b/src/engine/imap/transport/imap-client-session.vala
index f42112f26..81d892ef0 100644
--- a/src/engine/imap/transport/imap-client-session.vala
+++ b/src/engine/imap/transport/imap-client-session.vala
@@ -599,6 +599,9 @@ public class Geary.Imap.ClientSession : BaseObject, Logging.Source {
             }
             if (ns == null) {
                 // fall back to the default personal namespace
+                if (this.personal_namespaces.is_empty) {
+                    throw new ImapError.UNAVAILABLE("No personal namespace");
+                }
                 ns = this.personal_namespaces[0];
             }
 


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