comparison 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
comparison
equal deleted inserted replaced
1760:47dcc46bb091 1761:70caa62ead63
1927 1927
1928 static void 1928 static void
1929 on_chardet_detector_cbox_changed(GtkComboBox * combobox, gpointer data) 1929 on_chardet_detector_cbox_changed(GtkComboBox * combobox, gpointer data)
1930 { 1930 {
1931 ConfigDb *db; 1931 ConfigDb *db;
1932 gint position; 1932 gint position = 0;
1933 1933
1934 position = gtk_combo_box_get_active(GTK_COMBO_BOX(combobox)); 1934 position = gtk_combo_box_get_active(GTK_COMBO_BOX(combobox));
1935 cfg.chardet_detector = (char *)chardet_detector_presets[position]; 1935 cfg.chardet_detector = (char *)chardet_detector_presets[position];
1936 1936
1937 db = bmp_cfg_db_open(); 1937 db = bmp_cfg_db_open();
2000 2000
2001 static void 2001 static void
2002 on_chardet_fallback_changed(GtkEntry *entry, gpointer data) 2002 on_chardet_fallback_changed(GtkEntry *entry, gpointer data)
2003 { 2003 {
2004 ConfigDb *db; 2004 ConfigDb *db;
2005 gchar *ret = NULL;
2005 2006
2006 if(cfg.chardet_fallback) 2007 if(cfg.chardet_fallback)
2007 g_free(cfg.chardet_fallback); 2008 g_free(cfg.chardet_fallback);
2008 2009
2009 cfg.chardet_fallback = g_strdup(gtk_entry_get_text(entry)); 2010 ret = g_strdup(gtk_entry_get_text(entry));
2011
2012 if(ret == NULL)
2013 cfg.chardet_fallback = g_strdup("");
2014 else
2015 cfg.chardet_fallback = ret;
2010 2016
2011 db = bmp_cfg_db_open(); 2017 db = bmp_cfg_db_open();
2012 2018
2013 if(!strncasecmp(cfg.chardet_fallback, "", sizeof(""))) 2019 if(cfg.chardet_fallback == NULL || !strcmp(cfg.chardet_fallback, ""))
2014 bmp_cfg_db_set_string(db, NULL, "chardet_fallback", "None"); 2020 bmp_cfg_db_set_string(db, NULL, "chardet_fallback", "None");
2015 else 2021 else
2016 bmp_cfg_db_set_string(db, NULL, "chardet_fallback", cfg.chardet_fallback); 2022 bmp_cfg_db_set_string(db, NULL, "chardet_fallback", cfg.chardet_fallback);
2017 2023
2018 bmp_cfg_db_close(db); 2024 bmp_cfg_db_close(db);