summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2020-07-04 09:20:31 -0300
committerDavid Bremner <david@tethera.net>2020-07-13 07:19:22 -0300
commita606cba32b017f947c2d9f32477df69645c1c383 (patch)
treec60e2dd9bd847d8c4393100ada628e5ff49c69ab /lib
parent46e8076281073c8df5ae8e7e5b386981e2ef4c62 (diff)
lib/n_m_g_filename: catch Xapian exceptions, document NULL return
This is the same machinery as applied for notmuch_message_get_{thread,message}_id
Diffstat (limited to 'lib')
-rw-r--r--lib/message.cc7
-rw-r--r--lib/notmuch.h2
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/message.cc b/lib/message.cc
index 0551a427..1a9eaffe 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -1122,7 +1122,12 @@ _notmuch_message_ensure_filename_list (notmuch_message_t *message)
const char *
notmuch_message_get_filename (notmuch_message_t *message)
{
- _notmuch_message_ensure_filename_list (message);
+ try {
+ _notmuch_message_ensure_filename_list (message);
+ } catch (Xapian::Error &error) {
+ LOG_XAPIAN_EXCEPTION (message, error);
+ return NULL;
+ }
if (message->filename_list == NULL)
return NULL;
diff --git a/lib/notmuch.h b/lib/notmuch.h
index 037913f4..5c17ec7c 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -1433,6 +1433,8 @@ notmuch_message_count_files (notmuch_message_t *message);
* this function will arbitrarily return a single one of those
* filenames. See notmuch_message_get_filenames for returning the
* complete list of filenames.
+ *
+ * This function returns NULL if it triggers a Xapian exception.
*/
const char *
notmuch_message_get_filename (notmuch_message_t *message);