[gnome-todo] task: dereference pointer before comparing tasks



commit 0e25a7bacf5343555dc40286b1cd091c6c0dad37
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Sep 28 16:06:25 2017 -0300

    task: dereference pointer before comparing tasks
    
    We ~never~ pass a NULL pointer to a GtdTask pointer.

 src/gtd-task.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/gtd-task.c b/src/gtd-task.c
index 9fc05b0..30f1ff3 100644
--- a/src/gtd-task.c
+++ b/src/gtd-task.c
@@ -125,16 +125,16 @@ compare_by_subtasks (GtdTask **t1,
 {
   GtdTask *task1, *task2;
 
-  if (!t1 && !t2)
+  task1 = *t1;
+  task2 = *t2;
+
+  if (!task1 && !task2)
     return  0;
-  if (!t1)
+  if (!task1)
     return  1;
-  if (!t2)
+  if (!task2)
     return -1;
 
-  task1 = *t1;
-  task2 = *t2;
-
   if (share_same_ancestor (task1, task2))
     {
       gint depth_difference;


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