[gnome-music/gnome-3-12] playlists: Don't crash when all items are removed



commit d4f85be35faee5e3d90ae397f3f5d39bb5ed3c39
Author: Arnel A. Borja <arnelborja src gnome org>
Date:   Wed Apr 2 23:19:48 2014 +0800

    playlists: Don't crash when all items are removed
    
    Since TotemPlParser cannot save empty playlists, insert a dummy item if all
    items are removed in a playlist.

 gnomemusic/playlists.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/gnomemusic/playlists.py b/gnomemusic/playlists.py
index f79fe77..d5e720d 100644
--- a/gnomemusic/playlists.py
+++ b/gnomemusic/playlists.py
@@ -92,6 +92,8 @@ class Playlists(GObject.GObject):
                 playlist.set_value(_iter, TotemPlParser.PARSER_FIELD_URI, uri)
 
         def end_callback(parser, uri, data):
+            if playlist.size() == 0:
+                playlist.append()
             parser.save(playlist, pl_file, playlist_name, TotemPlParser.ParserType.PLS)
 
         parser.connect('entry-parsed', parse_callback, playlist)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]