schedule: set thread to NULL when there is no next thread
[model-checker.git] / schedule.c
index f5ce644810856b06b3002996a1d95c1e11f17b9d..a4613c597f95d3362888df1ba6051fbbb1d75a58 100644 (file)
@@ -32,8 +32,10 @@ static void enqueue_thread(struct thread *t)
 
 static int dequeue_thread(struct thread **t)
 {
-       if (!head)
+       if (!head) {
+               *t = NULL;
                return -1;
+       }
        *t = head->this;
        head->live = 0;
        if (head == tail)