[rhythmbox] ipod: don't crash when trying to show properties if ipod db load fails (bug #628791)



commit 703fe04402dabea4d4b1e76d5ffc4101ee4264bb
Author: Jonathan Matthew <jonathan d14n org>
Date:   Wed Oct 13 22:01:33 2010 +1000

    ipod: don't crash when trying to show properties if ipod db load fails (bug #628791)

 plugins/ipod/rb-ipod-source.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/plugins/ipod/rb-ipod-source.c b/plugins/ipod/rb-ipod-source.c
index 47a405b..847551e 100644
--- a/plugins/ipod/rb-ipod-source.c
+++ b/plugins/ipod/rb-ipod-source.c
@@ -2036,13 +2036,23 @@ get_mount_point	(RBiPodSource *source)
 static guint64
 impl_get_capacity (RBMediaPlayerSource *source)
 {
-	return rb_ipod_helpers_get_capacity (get_mount_point (RB_IPOD_SOURCE (source)));
+	RBiPodSourcePrivate *priv = IPOD_SOURCE_GET_PRIVATE (source);
+	if (priv->ipod_db) {
+		return rb_ipod_helpers_get_capacity (get_mount_point (RB_IPOD_SOURCE (source)));
+	} else {
+		return 0;
+	}
 }
 
 static guint64
 impl_get_free_space (RBMediaPlayerSource *source)
 {
-	return rb_ipod_helpers_get_free_space (get_mount_point (RB_IPOD_SOURCE (source)));
+	RBiPodSourcePrivate *priv = IPOD_SOURCE_GET_PRIVATE (source);
+	if (priv->ipod_db) {
+		return rb_ipod_helpers_get_free_space (get_mount_point (RB_IPOD_SOURCE (source)));
+	} else {
+		return 0;
+	}
 }
 
 static void



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