Don't crash displaying contacts with no alias

If a folks individual has no alias we crash when passing in NULL
to strstr(). Fix this by checking for non-null first.
This commit is contained in:
Alexander Larsson 2011-08-30 11:13:35 +02:00
parent be4d504e27
commit c2c4c26f72

View File

@ -134,11 +134,14 @@ do_match (ShellContactSystem *self,
const char *p; const char *p;
/* Match on alias */ /* Match on alias */
p = strstr (alias, term); if (alias != NULL)
if (p == alias) {
have_alias_prefix = TRUE; p = strstr (alias, term);
else if (p != NULL) if (p == alias)
have_alias_substring = TRUE; have_alias_prefix = TRUE;
else if (p != NULL)
have_alias_substring = TRUE;
}
/* Match on one or more IM addresses */ /* Match on one or more IM addresses */
im_addrs_iter = gee_iterable_iterator (GEE_ITERABLE (im_addrs)); im_addrs_iter = gee_iterable_iterator (GEE_ITERABLE (im_addrs));