commit 72a71a788ea0a1139f50574229539db6b4f71318
Author: Adam Broschinski <[email protected]>
Date:   Sat Apr 10 22:35:03 2010 -0400

    Removed unneeded assertion
    
    I removed the assertion that itdb->tracks be nonempty when writing out
    the a playlist. This allows the master playlist to be written just after
    initialization.

 src/itdb_itunesdb.c |   30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)
---
diff --git a/src/itdb_itunesdb.c b/src/itdb_itunesdb.c
index 094c762..6ba72a5 100644
--- a/src/itdb_itunesdb.c
+++ b/src/itdb_itunesdb.c
@@ -6305,7 +6305,6 @@ static gboolean write_lphs (WContents *cts, Itdb_Playlist 
*pl)
 
        g_return_val_if_fail (pl, FALSE);
        g_return_val_if_fail (pl->itdb, FALSE);
-       g_return_val_if_fail (pl->itdb->tracks, FALSE);
        g_return_val_if_fail (cts, FALSE);
 
        lphs_seek=cts->pos;
@@ -6328,23 +6327,26 @@ static gboolean write_lphs (WContents *cts, 
Itdb_Playlist *pl)
 
        put32lint (cts, stype); /* Type of playlist */
        put32_n0 (cts, 4); /* Unknown */
-       /* Walk the playlist and find and write out the track number
-          of each track in it */
-       for( tl = pl -> members; tl; tl = tl->next)
+       if (tracks) /* It makes no sense to do the following if there is no 
tracks */
        {
-               tracknum = 0;
-               current_track= tracks;
-               tr = tl->data;
-               id = tr->dbid;
-               ctr = current_track->data;
-               while( id != ctr->dbid)
+               /* Walk the playlist and find and write out the track number
+                  of each track in it */
+               for( tl = pl -> members; tl; tl = tl->next)
                {
-                       tracknum ++;
-                       current_track = current_track->next;
-                       g_return_val_if_fail (current_track, FALSE);
+                       tracknum = 0;
+                       current_track= tracks;
+                       tr = tl->data;
+                       id = tr->dbid;
                        ctr = current_track->data;
+                       while( id != ctr->dbid)
+                       {
+                               tracknum ++;
+                               current_track = current_track->next;
+                               g_return_val_if_fail (current_track, FALSE);
+                               ctr = current_track->data;
+                       }
+                       put32lint (cts, tracknum);
                }
-               put32lint (cts, tracknum);
        }
 
        fix_short_header (cts, lphs_seek);

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to