[gnome-music] playlists: Don't crash when all items are removed
- From: Arnel A. Borja <arnelborja src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] playlists: Don't crash when all items are removed
- Date: Wed, 2 Apr 2014 15:24:14 +0000 (UTC)
commit 558a6af16da5ace91ace06daf292f8272918c403
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]