diff --git a/src/kex.c b/src/kex.c index 07e717f..ca227b8 100644 --- a/src/kex.c +++ b/src/kex.c @@ -1756,7 +1756,7 @@ _libssh2_kex_exchange(LIBSSH2_SESSION * session, int reexchange, key_state->state = libssh2_NB_state_sent2; } - if (rc == 0) { + if (rc == 0 && session->kex) { if (key_state->state == libssh2_NB_state_sent2) { retcode = session->kex->exchange_keys(session, &key_state->key_state_low);