diff options
author | Austin Clements <amdragon@mit.edu> | 2014-10-06 17:17:09 -0600 |
---|---|---|
committer | David Bremner <david@tethera.net> | 2014-10-11 07:10:12 +0200 |
commit | 7487e2e2214b27407e542df164a4d23520bbd8d8 (patch) | |
tree | b92f7510030dba44749eaff48a331291b751d067 /lib | |
parent | 46b1b035a5b82379706b9adee78568738f135123 (diff) |
lib: Handle empty date value
In the interest of robustness, avoid undefined behavior of
sortable_unserialise if the date value is missing. This shouldn't
happen now, but ghost messages will have blank date values.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/message.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/message.cc b/lib/message.cc index bbfc2500..38bc9291 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -896,6 +896,9 @@ notmuch_message_get_date (notmuch_message_t *message) return 0; } + if (value.empty ()) + /* sortable_unserialise is undefined on empty string */ + return 0; return Xapian::sortable_unserialise (value); } |