]> git.decadent.org.uk Git - ion3.git/blobdiff - ioncore/grouppholder.c
[svn-upgrade] Integrating new upstream version, ion3 (20080411)
[ion3.git] / ioncore / grouppholder.c
index 39ff6fc519b34372d61f1a98c52842607a826818..cdd2dce546b35b144132d83adc1340f63750e7ba 100644 (file)
@@ -72,17 +72,21 @@ void grouppholder_do_unlink(WGroupPHolder *ph)
     
     if(group!=NULL){
         UNLINK_ITEM(group->phs, ph, next, prev);
-    }else{
+    }else if(ph->prev!=NULL){
         WGroupPHolder *next=ph->next;
         
-        if(ph->prev!=NULL)
-            ph->prev->next=next;
+        ph->prev->next=next;
 
         if(next==NULL){
             next=get_head(ph);
             assert(next->prev==ph);
         }
         next->prev=ph->prev;
+    }else{
+        /* ph should not be on a list, if prev pointer is NULL (whereas
+         * next alone can be NULL in our semi-doubly-linked lists).
+         */
+        assert(ph->next==NULL);
     }
     
     ph->group=NULL;