X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=lib%2Fmessage.cc;h=c4261e614d4eb83b605bd2312cad727a57b9ab95;hb=8d6aa603ef3a9680c7032cabf59e3673f773dea3;hp=8720c1b542d839a24613991b4b425fe03f65e1e3;hpb=16aa65ba2575fd504c31d9671d8c5150f8e8adf1;p=notmuch diff --git a/lib/message.cc b/lib/message.cc index 8720c1b5..c4261e61 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -266,18 +266,18 @@ _notmuch_message_get_term (notmuch_message_t *message, const char *prefix) { int prefix_len = strlen (prefix); - const char *term = NULL; char *value; i.skip_to (prefix); - if (i != end) - term = (*i).c_str (); + if (i == end) + return NULL; - if (!term || strncmp (term, prefix, prefix_len)) + std::string term = *i; + if (strncmp (term.c_str(), prefix, prefix_len)) return NULL; - value = talloc_strdup (message, term + prefix_len); + value = talloc_strdup (message, term.c_str() + prefix_len); #if DEBUG_DATABASE_SANITY i++;