]> git.notmuchmail.org Git - notmuch/blobdiff - mime-node.c
cli/crypto: fix segfault on failed gmime2 crypto context creation
[notmuch] / mime-node.c
index bc41b7523c486f72f48b3b132e9241454c568857..1609173576e2fa4830e04540231f008bab48f2c8 100644 (file)
@@ -240,14 +240,16 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)
        return NULL;
     }
 
+#if (GMIME_MAJOR_VERSION < 3)
     if ((GMIME_IS_MULTIPART_ENCRYPTED (part) && node->ctx->crypto->decrypt)
        || (GMIME_IS_MULTIPART_SIGNED (part) && node->ctx->crypto->verify)) {
        GMimeContentType *content_type = g_mime_object_get_content_type (part);
        const char *protocol = g_mime_content_type_get_parameter (content_type, "protocol");
        cryptoctx = notmuch_crypto_get_context (node->ctx->crypto, protocol);
        if (!cryptoctx)
-           return NULL;
+           return node;
     }
+#endif
 
     /* Handle PGP/MIME parts */
     if (GMIME_IS_MULTIPART_ENCRYPTED (part) && node->ctx->crypto->decrypt) {