diff audacious/prefswin.c @ 1761:70caa62ead63 trunk

[svn] - fix for "bmp_rcfile_write_string: assertion `value != NULL' failed"
author yaz
date Thu, 28 Sep 2006 08:39:14 -0700
parents 6b9e1c2b2b32
children 7d32dff734da
line wrap: on
line diff
--- a/audacious/prefswin.c	Thu Sep 28 08:36:43 2006 -0700
+++ b/audacious/prefswin.c	Thu Sep 28 08:39:14 2006 -0700
@@ -1929,7 +1929,7 @@
 on_chardet_detector_cbox_changed(GtkComboBox * combobox, gpointer data)
 {
     ConfigDb *db;
-    gint position;
+    gint position = 0;
 
     position = gtk_combo_box_get_active(GTK_COMBO_BOX(combobox));
     cfg.chardet_detector = (char *)chardet_detector_presets[position];
@@ -2002,15 +2002,21 @@
 on_chardet_fallback_changed(GtkEntry *entry, gpointer data)
 {
     ConfigDb *db;
+    gchar *ret = NULL;
 
     if(cfg.chardet_fallback)
         g_free(cfg.chardet_fallback);
 
-    cfg.chardet_fallback = g_strdup(gtk_entry_get_text(entry));
+    ret = g_strdup(gtk_entry_get_text(entry));
+
+    if(ret == NULL)
+        cfg.chardet_fallback = g_strdup("");
+    else
+        cfg.chardet_fallback = ret;
 
     db = bmp_cfg_db_open();
 
-    if(!strncasecmp(cfg.chardet_fallback, "", sizeof("")))
+    if(cfg.chardet_fallback == NULL || !strcmp(cfg.chardet_fallback, ""))
         bmp_cfg_db_set_string(db, NULL, "chardet_fallback", "None");
     else
         bmp_cfg_db_set_string(db, NULL, "chardet_fallback", cfg.chardet_fallback);