]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-imap-client: Fix imapc_client_get_capabilities() when called without connections
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sun, 23 Apr 2017 16:57:11 +0000 (19:57 +0300)
committerGitLab <gitlab@git.dovecot.net>
Mon, 24 Apr 2017 08:41:26 +0000 (11:41 +0300)
src/lib-imap-client/imapc-client.c

index d11ab066a5b87a7531910868c23f6ac17be55b96..7fbd4257aa68ac17f23450184fce62605cb280e1 100644 (file)
@@ -530,8 +530,11 @@ int imapc_client_get_capabilities(struct imapc_client *client,
        if (imapc_client_get_any_capabilities(client, capabilities_r))
                return 0;
 
-       /* wait for any of the connections to login (there always exists one) */
-       i_assert(array_count(&client->conns) > 0);
+       /* if there are no connections yet, create one */
+       if (array_count(&client->conns) == 0)
+               (void)imapc_client_add_connection(client);
+
+       /* wait for any of the connections to login */
        imapc_client_run(client);
        if (imapc_client_get_any_capabilities(client, capabilities_r))
                return 0;