aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
Diffstat (limited to 'e-util')
-rw-r--r--e-util/ename/e-name-western.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/e-util/ename/e-name-western.c b/e-util/ename/e-name-western.c
index 755d7eabed..057afdacc1 100644
--- a/e-util/ename/e-name-western.c
+++ b/e-util/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;