[Goodies-commits] r4128 - xfbib/trunk/src

Jesper Karlsson zarper at xfce.org
Sat Mar 29 20:51:53 CET 2008


Author: zarper
Date: 2008-03-29 19:51:53 +0000 (Sat, 29 Mar 2008)
New Revision: 4128

Modified:
   xfbib/trunk/src/entry_edit_dialog.c
Log:
Xfbib: Fixed some lines that could produce segfaults.

Modified: xfbib/trunk/src/entry_edit_dialog.c
===================================================================
--- xfbib/trunk/src/entry_edit_dialog.c	2008-03-29 19:40:18 UTC (rev 4127)
+++ xfbib/trunk/src/entry_edit_dialog.c	2008-03-29 19:51:53 UTC (rev 4128)
@@ -558,9 +558,11 @@
 					selected->key = strdup(key);
 					selected->type = strdup(type);
 					free_tags(selected->tags);
+					selected->tags = NULL;
 				}
 				for (i = 0; i < N_ENTRIES; i++) {
 					if(GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(edit_entry[i].entry))) {
+						_DEBUG(("Widget is sensitive: %u", i));
 						if (i == AUTHOR || i == EDITOR) {
 							model = gtk_tree_view_get_model(GTK_TREE_VIEW(edit_entry[i].entry));
 							value = NULL;
@@ -578,7 +580,9 @@
 							}
 						} else
 							value = (char *) gtk_entry_get_text(GTK_ENTRY(edit_entry[i].entry));
-						if(strcmp(value, "") != 0) {
+						_DEBUG(("Checking if empty: %s", value));
+						if(value != NULL && strcmp(value, "") != 0) {
+							_DEBUG(("Is empty"));
 							fprintf(stderr, "label = %s\tvalue = %s\n", gtk_label_get_text(GTK_LABEL(edit_entry[i].label)), value);
 							add_tag(selected,(char*) gtk_label_get_text(GTK_LABEL(edit_entry[i].label)), value,
 									gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (edit_entry[i].toggle)));




More information about the Goodies-commits mailing list