changeset 4526:8465e73d5584

Check for NULL playlist pointer in configuration saving. This situation may occur if the process is interrupted by a signal.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 30 Apr 2008 04:38:01 +0300
parents 16466c2624b2
children 53bd726e4461
files src/audacious/audconfig.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/audconfig.c	Wed Apr 30 04:35:59 2008 +0300
+++ b/src/audacious/audconfig.c	Wed Apr 30 04:38:01 2008 +0300
@@ -632,8 +632,10 @@
 
     /* This is a bit lame .. it'll end up being written twice,
      * could do with being done a bit neater.  -larne   */
-    cfg_db_set_int(db, NULL, "playlist_position",
+    if (playlist) {
+        cfg_db_set_int(db, NULL, "playlist_position",
                        playlist_get_position(playlist));
+    }
 
     hook_call("config save", db);
 
@@ -747,7 +749,9 @@
 
     cfg_db_close(db);
 
-    playlist_save(playlist, aud_paths[BMP_PATH_PLAYLIST_FILE]);
+    if (!playlist_save(playlist, aud_paths[BMP_PATH_PLAYLIST_FILE])) {
+        g_warning("Could not save main playlist\n");
+    }
 
     /* Save extra playlists that were loaded from PLAYLISTS_DIR  */
     saved = NULL;