diff options
author | Carl Worth <cworth@cworth.org> | 2009-10-19 13:24:12 -0700 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2009-10-19 13:24:12 -0700 |
commit | 401c6cc5793331773c0230e8ae00e8c4b0c63a5e (patch) | |
tree | 89cd27f4eec3b18f5643f794e1ec7aca0ed4df0e /date.c | |
parent | 8e4e0559e74262c3e24f832e5cf729287be205c7 (diff) |
notmuch_parse_date: Handle a NULL date string gracefully.
The obvious thing to do is to treat a missing date as the beginning
of time. Also, remove a useless cast from another return of 0.
Diffstat (limited to 'date.c')
-rw-r--r-- | date.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -643,12 +643,15 @@ notmuch_parse_date (const char *str, int *tz_offset) { date_token *token, *tokens; time_t date; - + + if (str == NULL) + return 0; + if (!(tokens = datetok (str))) { if (tz_offset) *tz_offset = 0; - return (time_t) 0; + return 0; } if (!(date = parse_rfc822_date (tokens, tz_offset))) |