]> 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)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 24 Apr 2017 08:48:47 +0000 (11:48 +0300)
src/lib-imap-client/imapc-client.c

index 5755e4b96392c7566e9d2955af16489d2ecece06..fa90286f9e245ea5ef798d31edaf4ae4f7819ea5 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;