fixed order by

Fri, 02 Oct 2015 13:29:32 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Fri, 02 Oct 2015 13:29:32 +0200
changeset 140
0a06bed068a1
parent 139
c6424aebcf5e
child 141
b0c44be83276

fixed order by

libidav/resource.c file | annotate | diff | comparison | revisions
--- a/libidav/resource.c	Fri Oct 02 13:18:17 2015 +0200
+++ b/libidav/resource.c	Fri Oct 02 13:29:32 2015 +0200
@@ -367,7 +367,7 @@
                 }
             }
             
-            if(r < 0 || !resource->next) {
+            if(r < 0) {
                 // insert child before resource
                 child->prev = resource->prev;
                 child->next = resource;
@@ -378,6 +378,12 @@
                 }
                 resource->prev = child;
                 break;
+            } if(!resource->next) {
+                // append child
+                child->prev = resource;
+                child->next = NULL;
+                resource->next = child;
+                break;
             } else {
                 resource = resource->next;
             }

mercurial