diff --git a/common/Quadruple.cc b/common/Quadruple.cc
index d2dcc6d92ca680040fa3f314f7be5bcea9dc42a5..b4b7ce616591a6a0c31bef96239ccf1445623d18 100644
--- a/common/Quadruple.cc
+++ b/common/Quadruple.cc
@@ -431,7 +431,9 @@ void QuadSet::add(QuadInterval* interval) {
         if (it == set)
           set = it->next;
         quadset_node_t* p = it;
-        it_old->next = it->next;
+        if (it_old != 0) {
+          it_old->next = it->next;
+        }
         it = it->next;
         delete p;
         continue;