[geary/wip/account-editor-refinements-v1: 7/7] Fix critical when IMAP login command is cancelled



commit 33ae35f613ea76cd07f9b81474a0086fa74716fc
Author: Michael Gratton <mike vee net>
Date:   Wed Jan 9 12:27:52 2019 +1100

    Fix critical when IMAP login command is cancelled
    
    The command's status will be null if the op was cancelled.

 src/engine/imap/transport/imap-client-session.vala | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/src/engine/imap/transport/imap-client-session.vala 
b/src/engine/imap/transport/imap-client-session.vala
index ef3d44c7..4613a0d6 100644
--- a/src/engine/imap/transport/imap-client-session.vala
+++ b/src/engine/imap/transport/imap-client-session.vala
@@ -881,14 +881,16 @@ public class Geary.Imap.ClientSession : BaseObject {
         }
 
         if (login_err != null) {
-            // Throw an error indicating auth failed here, unless the
-            // response code indicated that the server is merely
-            // unavailable, then don't since the creds might actually
-            // be fine.
-            ResponseCode? code = cmd.status.response_code;
+            // Throw an error indicating auth failed here, unless
+            // there is a status response and it indicates that the
+            // server is merely reporting login as being unavailable,
+            // then don't since the creds might actually be fine.
             ResponseCodeType? code_type = null;
-            if (code != null) {
-                code_type = code.get_response_code_type();
+            if (cmd.status != null) {
+                ResponseCode? code = cmd.status.response_code;
+                if (code != null) {
+                    code_type = code.get_response_code_type();
+                }
             }
 
             if (code_type == null ||


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