[gnome-disk-utility] Bug 613004 – Crash in gdu_adapter_get_object_path at gdu-adapter.c:288



commit e3ae27c89d66c683b4a37d40df290d0a0cd0aed1
Author: David Zeuthen <davidz redhat com>
Date:   Mon Mar 22 11:18:02 2010 -0400

    Bug 613004 â?? Crash in gdu_adapter_get_object_path at gdu-adapter.c:288
    
    Some GduHub instances may not have an adapter - so
    gdu_hub_get_adapter() may return NULL. Deal with it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=613004

 src/gdu/gdu-pool.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/gdu/gdu-pool.c b/src/gdu/gdu-pool.c
index eebf440..bd5eccf 100644
--- a/src/gdu/gdu-pool.c
+++ b/src/gdu/gdu-pool.c
@@ -2777,13 +2777,14 @@ gdu_pool_get_hub_by_object_path (GduPool *pool, const gchar *object_path)
                 a = gdu_hub_get_adapter (GDU_HUB (p));
                 e = gdu_hub_get_expander (GDU_HUB (p));
 
-                if (g_strcmp0 (gdu_adapter_get_object_path (a), object_path) == 0) {
+                if (a != NULL && g_strcmp0 (gdu_adapter_get_object_path (a), object_path) == 0) {
                         ret = g_object_ref (p);
                 } else if (e != NULL && g_strcmp0 (gdu_expander_get_object_path (e), object_path) == 0) {
                         ret = g_object_ref (p);
                 }
 
-                g_object_unref (a);
+                if (a != NULL)
+                        g_object_unref (a);
                 if (e != NULL)
                         g_object_unref (e);
         }



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