changeset 3636:65b750891387

Possibly fix a lockup problem.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 25 Sep 2007 23:09:09 +0300
parents b20e98407a30
children d0775f9708e8
files src/audacious/playlist.c
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/playlist.c	Tue Sep 25 23:06:26 2007 +0300
+++ b/src/audacious/playlist.c	Tue Sep 25 23:09:09 2007 +0300
@@ -670,6 +670,7 @@
     PlaylistEntry *entry;
     Tuple *main_tuple = NULL;
     gint nsubtunes = 0, i = 0;
+    gboolean add_flag = TRUE;
 
     g_return_if_fail(playlist != NULL);
     g_return_if_fail(filename != NULL);
@@ -682,7 +683,7 @@
         }
     }
 
-    for (; i <= nsubtunes; i++) {
+    for (; add_flag && i <= nsubtunes; i++) {
         gchar *filename_entry;
         
         if (nsubtunes > 0) {
@@ -701,7 +702,7 @@
             tuple ? tuple_get_int(tuple, FIELD_LENGTH, NULL) : -1, dec);
         g_free(filename_entry);
 
-        if(!playlist->tail)
+        if (!playlist->tail)
             playlist->tail = g_list_last(playlist->entries);
 
         PLAYLIST_LOCK(playlist);
@@ -717,9 +718,11 @@
                 playlist->entries = element;
                 playlist->tail = element;
             } else { // the rests
-                g_return_if_fail(playlist->tail != NULL);
-                playlist->tail->next = element;
-                playlist->tail = element;
+                if (playlist->tail != NULL) {
+                    playlist->tail->next = element;
+                    playlist->tail = element;
+                } else
+                    add_flag = FALSE;
             }
         } else {
             playlist->entries = g_list_insert(playlist->entries, entry, pos);