[gnome-shell] Don't crash displaying contacts with no alias



commit c2c4c26f72b900d0a95c5daca64c46cb7e281f33
Author: Alexander Larsson <alexl redhat com>
Date:   Tue Aug 30 11:13:35 2011 +0200

    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.

 src/shell-contact-system.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/shell-contact-system.c b/src/shell-contact-system.c
index 971a164..9ac79de 100644
--- a/src/shell-contact-system.c
+++ b/src/shell-contact-system.c
@@ -134,11 +134,14 @@ do_match (ShellContactSystem  *self,
       const char *p;
 
       /* Match on alias */
-      p = strstr (alias, term);
-      if (p == alias)
-        have_alias_prefix = TRUE;
-      else if (p != NULL)
-        have_alias_substring = TRUE;
+      if (alias != NULL)
+	{
+	  p = strstr (alias, term);
+	  if (p == alias)
+	    have_alias_prefix = TRUE;
+	  else if (p != NULL)
+	    have_alias_substring = TRUE;
+	}
 
       /* Match on one or more IM addresses */
       im_addrs_iter = gee_iterable_iterator (GEE_ITERABLE (im_addrs));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]