[tracker: 8/30] tracker-extract: Do not add statistics data if no module handled the file



commit e1c7d0861ac7e4574b5db5fbd6ff9effd69e2c90
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Jan 7 22:12:19 2014 +0100

    tracker-extract: Do not add statistics data if no module handled the file
    
    This prevents a crash when reporting the statistics later, as there is a
    NULL key that is expected to be a GModule.

 src/tracker-extract/tracker-extract.c |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract.c b/src/tracker-extract/tracker-extract.c
index 3f6c8c4..ece7398 100644
--- a/src/tracker-extract/tracker-extract.c
+++ b/src/tracker-extract/tracker-extract.c
@@ -254,20 +254,24 @@ notify_task_finish (TrackerExtractTask *task,
         */
        g_mutex_lock (&priv->task_mutex);
 
-       stats_data = g_hash_table_lookup (priv->statistics_data,
-                                         task->cur_module);
-
-       if (!stats_data) {
-               stats_data = g_slice_new0 (StatisticsData);
-               g_hash_table_insert (priv->statistics_data,
-                                    task->cur_module,
-                                    stats_data);
-       }
+       if (task->cur_module) {
+               stats_data = g_hash_table_lookup (priv->statistics_data,
+                                                 task->cur_module);
+
+               if (!stats_data) {
+                       stats_data = g_slice_new0 (StatisticsData);
+                       g_hash_table_insert (priv->statistics_data,
+                                            task->cur_module,
+                                            stats_data);
+               }
 
-       stats_data->extracted_count++;
+               stats_data->extracted_count++;
 
-       if (!success) {
-               stats_data->failed_count++;
+               if (!success) {
+                       stats_data->failed_count++;
+               }
+       } else {
+               priv->unhandled_count++;
        }
 
        priv->running_tasks = g_list_remove (priv->running_tasks, task);


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