diff --git a/crypto/x509/v3_lib.c b/crypto/x509/v3_lib.c index 6b12975761..322a210af5 100644 --- a/crypto/x509/v3_lib.c +++ b/crypto/x509/v3_lib.c @@ -150,7 +150,7 @@ const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid) { const X509V3_EXT_METHOD *X509V3_EXT_get(const X509_EXTENSION *ext) { int nid; - if ((nid = OBJ_obj2nid(ext->object)) == NID_undef) { + if (ext == NULL || (nid = OBJ_obj2nid(ext->object)) == NID_undef) { return NULL; } return X509V3_EXT_get_nid(nid);