aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/ename
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/ename')
-rw-r--r--addressbook/ename/e-name-western.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/addressbook/ename/e-name-western.c b/addressbook/ename/e-name-western.c
index 755d7eabed..057afdacc1 100644
--- a/addressbook/ename/e-name-western.c
+++ b/addressbook/ename/e-name-western.c
@@ -300,13 +300,16 @@ e_name_western_extract_middle (ENameWestern *name, ENameWesternIdxs *idxs)
middle_idx = idxs->first_idx + strlen (name->first) + 1;
+ if (middle_idx > strlen (name->full))
+ return;
+
+ /*
+ * Search for the first space (or the terminating \0)
+ */
while (isspace (name->full [middle_idx]) &&
name->full [middle_idx] != '\0')
middle_idx ++;
- if (middle_idx > strlen (name->full))
- return;
-
if (name->full [middle_idx] == '\0')
return;