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



commit 4f7fdea267e1162a972568e5e09a321208046e06
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 1143dad..389f5ad 100644
--- a/src/gtd-task.c
+++ b/src/gtd-task.c
@@ -122,16 +122,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]