[PATCH] gdu-volume-monitor: fix segmentation fault



The initialisation of gdu_pool can return NULL as pool.
gdu_pool_get_presentables expects a non NULL parameter, so
don't call it, if pool is NULL.

Signed-off-by: Martin Koegler <mkoegler auto tuwien ac at>
---
 monitor/gdu/ggduvolumemonitor.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/monitor/gdu/ggduvolumemonitor.c b/monitor/gdu/ggduvolumemonitor.c
index bcf23f1..d021530 100644
--- a/monitor/gdu/ggduvolumemonitor.c
+++ b/monitor/gdu/ggduvolumemonitor.c
@@ -1206,7 +1206,7 @@ update_drives (GGduVolumeMonitor *monitor,
   /* remove devices we want to ignore - we do it here so we get to reevaluate
    * on the next update whether they should still be ignored
    */
-  new_drives = gdu_pool_get_presentables (monitor->pool);
+  new_drives = monitor->pool ? gdu_pool_get_presentables (monitor->pool) : NULL;
   for (l = new_drives; l != NULL; l = ll)
     {
       GduPresentable *p = GDU_PRESENTABLE (l->data);
@@ -1289,7 +1289,7 @@ update_volumes (GGduVolumeMonitor *monitor,
   /* remove devices we want to ignore - we do it here so we get to reevaluate
    * on the next update whether they should still be ignored
    */
-  new_volumes = gdu_pool_get_presentables (monitor->pool);
+  new_volumes = monitor->pool ? gdu_pool_get_presentables (monitor->pool) : NULL;
   for (l = new_volumes; l != NULL; l = ll)
     {
       GduPresentable *p = GDU_PRESENTABLE (l->data);
@@ -1610,7 +1610,7 @@ update_discs (GGduVolumeMonitor *monitor,
   for (l = monitor->disc_volumes; l != NULL; l = l->next)
     cur_discs = g_list_prepend (cur_discs, g_gdu_volume_get_presentable (G_GDU_VOLUME (l->data)));
 
-  new_discs = gdu_pool_get_presentables (monitor->pool);
+  new_discs = monitor->pool ? gdu_pool_get_presentables (monitor->pool) : NULL;
   for (l = new_discs; l != NULL; l = ll)
     {
       GduPresentable *p = GDU_PRESENTABLE (l->data);
-- 
1.6.5.4



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