aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2010-04-27 17:12:16 -0700
committerCarl Worth <cworth@cworth.org>2010-04-27 17:13:47 -0700
commit417274d698b6718621b9f5dec744ab169499f4e3 (patch)
treebebe2f8373f435fc3fcb836e8cb65bc61016b2be /lib
parent229292a4b25cc776349ab1c461392a69301733c7 (diff)
parente9e1466b441769f77391080ee8d08ec1afac7a61 (diff)
Merge branch '0.3.x' immediately after the 0.3.1 release
This brings one bug fix into master that was originally applied directly to the 0.3.x branch.
Diffstat (limited to 'lib')
-rw-r--r--lib/thread.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/thread.cc b/lib/thread.cc
index dc74ee3e..13872d46 100644
--- a/lib/thread.cc
+++ b/lib/thread.cc
@@ -156,11 +156,19 @@ _thread_cleanup_author (notmuch_thread_t *thread,
char *blank;
int fname,lname;
+ if (author == NULL)
+ return NULL;
clean_author = talloc_strdup(thread, author);
if (clean_author == NULL)
return NULL;
+ /* check if there's a comma in the name and that there's a
+ * component of the name behind it (so the name doesn't end with
+ * the comma - in which case the string that strchr finds is just
+ * one character long ",\0").
+ * Otherwise just return the copy of the original author name that
+ * we just made*/
comma = strchr(author,',');
- if (comma) {
+ if (comma && strlen(comma) > 1) {
/* let's assemble what we think is the correct name */
lname = comma - author;
fname = strlen(author) - lname - 2;
@@ -180,7 +188,6 @@ _thread_cleanup_author (notmuch_thread_t *thread,
/* we didn't identify this as part of the email address
* so let's punt and return the original author */
strcpy (clean_author, author);
-
}
return clean_author;
}