stack.c: add missing direct error reporting and improve coding style
[openssl.git] / ssl / ssl_ciph.c
index e519d20362421fd3022e4f894a32f15ff8c29095..31d8acc102032bdb007c5e2a9aba2c344c4fbca4 100644 (file)
@@ -532,7 +532,8 @@ int ssl_cipher_get_evp(SSL_CTX *ctx, const SSL_SESSION *s,
         ctmp.id = s->compress_meth;
         if (ssl_comp_methods != NULL) {
             i = sk_SSL_COMP_find(ssl_comp_methods, &ctmp);
-            *comp = sk_SSL_COMP_value(ssl_comp_methods, i);
+            if (i >= 0)
+                *comp = sk_SSL_COMP_value(ssl_comp_methods, i);
         }
         /* If were only interested in comp then return success */
         if ((enc == NULL) && (md == NULL))