Fix dumping empty suffix tree
[tedtools.git] / glist.c
diff --git a/glist.c b/glist.c
index 59213ac..ba9fc9d 100644 (file)
--- a/glist.c
+++ b/glist.c
@@ -118,11 +118,15 @@ GListDelete(GList *l, GListCell *c) {
                l->head = c->next;
                if ( l->head ) 
                        l->head->prev = NULL;
+               else
+                       l->tail = NULL;
        } else if ( l->tail == c ) {
                tassert( c->next == NULL );
                l->tail = c->prev;
                if ( l->tail )
                        l->tail->next = NULL;
+               else
+                       l->head = NULL;
        } else {
                c->prev->next = c->next;
                c->next->prev = c->prev;