From 33ae35f613ea76cd07f9b81474a0086fa74716fc Mon Sep 17 00:00:00 2001 From: Michael Gratton Date: Wed, 9 Jan 2019 12:27:52 +1100 Subject: [PATCH] Fix critical when IMAP login command is cancelled The command's status will be null if the op was cancelled. --- .../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 ||