comparison src/adplug/adplug-xmms.cc @ 1045:028b7ca16d30 trunk

[svn] - fix crash if Exclude does not exist.
author yaz
date Sun, 20 May 2007 14:12:57 -0700
parents b1128efde471
children 8b02086025f9
comparison
equal deleted inserted replaced
1044:b1128efde471 1045:028b7ca16d30
1037 (gboolean *) & cfg.endless); 1037 (gboolean *) & cfg.endless);
1038 1038
1039 // Read file type exclusion list 1039 // Read file type exclusion list
1040 dbg_printf ("exclusion, "); 1040 dbg_printf ("exclusion, ");
1041 { 1041 {
1042 gchar *cfgstr = NULL, *exclude; 1042 gchar *cfgstr = NULL, *exclude = NULL;
1043 gboolean cfgread; 1043 gboolean cfgread;
1044 1044
1045 cfgread = bmp_cfg_db_get_string (db, CFG_VERSION, "Exclude", &cfgstr); 1045 cfgread = bmp_cfg_db_get_string (db, CFG_VERSION, "Exclude", &cfgstr);
1046 exclude = (char *) malloc (strlen (cfgstr) + 2); 1046 if (cfgread) {
1047 strcpy (exclude, cfgstr); 1047 exclude = (char *) malloc (strlen (cfgstr) + 2);
1048 exclude[strlen (exclude) + 1] = '\0'; 1048 strcpy (exclude, cfgstr);
1049 if (cfgread) 1049 exclude[strlen (exclude) + 1] = '\0';
1050 free (cfgstr); 1050 g_strdelimit (exclude, ":", '\0');
1051 g_strdelimit (exclude, ":", '\0'); 1051 for (gchar * p = exclude; *p; p += strlen (p) + 1)
1052 for (gchar * p = exclude; *p; p += strlen (p) + 1) 1052 cfg.players.remove (cfg.players.lookup_filetype (p));
1053 cfg.players.remove (cfg.players.lookup_filetype (p)); 1053 free (exclude); free (cfgstr);
1054 free (exclude); 1054 }
1055 } 1055 }
1056 bmp_cfg_db_close (db); 1056 bmp_cfg_db_close (db);
1057 1057
1058 // Load database from disk and hand it to AdPlug 1058 // Load database from disk and hand it to AdPlug
1059 dbg_printf ("database"); 1059 dbg_printf ("database");