Added checking if a list element is NULL. Now the dictionary won't dump core (hopefully)
authorkrzsas <krzsas@gmail.com>
Tue, 6 Mar 2007 09:25:27 +0000 (09:25 +0000)
committerkrzsas <krzsas@gmail.com>
Tue, 6 Mar 2007 09:25:27 +0000 (09:25 +0000)
git-svn-id: file:///svnroot/mdictionary/trunk@102 5bde0345-f819-0410-ac75-e5045f9217cc

src/gui/src/ws_gui_callbacks.c

index fbaa248..d076072 100644 (file)
@@ -429,7 +429,7 @@ void ws_gui_dbus_return_words (GError *error, GArray *words, gpointer user_data)
        if (ws_gui_app->history_flag == TRUE)
        {
 
-       GValue value = { 0, };
+       GValue value;// = { 0, };
        GtkTreeIter tmp_iter;
        gchar *pattern;
        gboolean keep_searching = TRUE;
@@ -448,7 +448,9 @@ void ws_gui_dbus_return_words (GError *error, GArray *words, gpointer user_data)
                                COL_WORD, 
                                &value);
 
-               if (strcmp(((gchar *)g_value_get_string (&value)), pattern) == 0)
+               if ((g_value_get_string (&value) != NULL) &&
+                               (strcmp(((gchar *)g_value_get_string (&value)), 
+                                pattern) == 0))
                {
                        gtk_tree_selection_select_iter(
                                ws_gui_app->ws_gui_w_list->ws_gui_selection,
@@ -465,7 +467,10 @@ void ws_gui_dbus_return_words (GError *error, GArray *words, gpointer user_data)
                                COL_WORD, 
                                &value);
 
-                       if (strcmp((gchar *)g_value_get_string (&value), pattern) == 0)
+//                     if (strcmp((gchar *)g_value_get_string (&value), pattern) == 0)
+                       if ((g_value_get_string (&value) != NULL) &&
+                                       (strcmp(((gchar *)g_value_get_string (&value)), 
+                                       pattern) == 0))
                                {
                                gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL(
                                ws_gui_app->ws_gui_w_list->ws_gui_model),
@@ -493,6 +498,7 @@ void ws_gui_dbus_return_words (GError *error, GArray *words, gpointer user_data)
                                ws_gui_app->ws_gui_history_cur_pos));
        
        ws_gui_app->html_flag = TRUE;
+       g_value_unset (&value);
        }
        
        
@@ -511,7 +517,7 @@ void ws_gui_dbus_return_words (GError *error, GArray *words, gpointer user_data)
                                        ws_gui_app->ws_gui_w_list->ws_gui_view),
                                         G_CALLBACK (ws_gui_view_cursor_changed), 
                                        ws_gui_app);    
-
+       
        
         timer(TIMER_STOP, (gchar*)__FUNCTION__);
 }