[gtk+] gtkentrycompletion: check return value because It can be non-UTF8



commit 910ad4872ca4413d958e4303245611acd3a84d0f
Author: Javier Jardón <jjardon gnome org>
Date:   Mon Jul 19 20:45:25 2010 +0200

    gtkentrycompletion: check return value because It can be non-UTF8
    
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=624270

 gtk/gtkentrycompletion.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkentrycompletion.c b/gtk/gtkentrycompletion.c
index 3bd43fb..8d066bc 100644
--- a/gtk/gtkentrycompletion.c
+++ b/gtk/gtkentrycompletion.c
@@ -790,15 +790,19 @@ gtk_entry_completion_default_completion_func (GtkEntryCompletion *completion,
   if (item != NULL)
     {
       normalized_string = g_utf8_normalize (item, -1, G_NORMALIZE_ALL);
-      case_normalized_string = g_utf8_casefold (normalized_string, -1);
-      
-      if (!strncmp (key, case_normalized_string, strlen (key)))
-	ret = TRUE;
-      
-      g_free (item);
+
+      if (normalized_string != NULL)
+        {
+          case_normalized_string = g_utf8_casefold (normalized_string, -1);
+
+          if (!strncmp (key, case_normalized_string, strlen (key)))
+	    ret = TRUE;
+
+          g_free (case_normalized_string);
+        }
       g_free (normalized_string);
-      g_free (case_normalized_string);
     }
+  g_free (item);
 
   return ret;
 }



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