diff 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
line wrap: on
line diff
--- a/src/adplug/adplug-xmms.cc	Sun May 20 12:05:48 2007 -0700
+++ b/src/adplug/adplug-xmms.cc	Sun May 20 14:12:57 2007 -0700
@@ -1039,19 +1039,19 @@
   // Read file type exclusion list
   dbg_printf ("exclusion, ");
   {
-    gchar *cfgstr = NULL, *exclude;
+    gchar *cfgstr = NULL, *exclude = NULL;
     gboolean cfgread;
 
     cfgread = bmp_cfg_db_get_string (db, CFG_VERSION, "Exclude", &cfgstr);
-    exclude = (char *) malloc (strlen (cfgstr) + 2);
-    strcpy (exclude, cfgstr);
-    exclude[strlen (exclude) + 1] = '\0';
-    if (cfgread)
-      free (cfgstr);
-    g_strdelimit (exclude, ":", '\0');
-    for (gchar * p = exclude; *p; p += strlen (p) + 1)
-      cfg.players.remove (cfg.players.lookup_filetype (p));
-    free (exclude);
+    if (cfgread) {
+        exclude = (char *) malloc (strlen (cfgstr) + 2);
+        strcpy (exclude, cfgstr);
+        exclude[strlen (exclude) + 1] = '\0';
+        g_strdelimit (exclude, ":", '\0');
+        for (gchar * p = exclude; *p; p += strlen (p) + 1)
+            cfg.players.remove (cfg.players.lookup_filetype (p));
+        free (exclude); free (cfgstr);
+    }
   }
   bmp_cfg_db_close (db);