From 97ba4f6238c730dff10a615043b62829c0ddb427 Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@monsoon.(none)>
Date: Tue, 16 Oct 2012 23:34:14 -0400
Subject: [PATCH] added additional check to make sure clock_unset is not trying
 to unset something that just happened (may require further testing, based on
 one gdb segfault log)

---
 src/m_sched.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/m_sched.c b/src/m_sched.c
index 49c6b5261..9ddb2624e 100644
--- a/src/m_sched.c
+++ b/src/m_sched.c
@@ -69,8 +69,8 @@ void clock_unset(t_clock *x)
         else
         {
             t_clock *x2 = clock_setlist;
-            while (x2->c_next != x) x2 = x2->c_next;
-            x2->c_next = x->c_next;
+            while (x2 && x2->c_next != x) x2 = x2->c_next;
+            if (x2) x2->c_next = x->c_next;
         }
         x->c_settime = -1;
     }
-- 
GitLab