From 2364a4b2307176c31c08fff36c6e5427af06aad1 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Tue, 1 Mar 2022 14:11:01 -0500 Subject: Fix infinite loop on script runs --- src/script.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/script.c b/src/script.c index 798f793..51db3da 100644 --- a/src/script.c +++ b/src/script.c @@ -318,19 +318,18 @@ int xas_script_play(xas_script *script, xas_audio_stream *sink) { } while (ev) { - xas_script_event *next = ev->next; struct timeval tv; ssize_t readlen; timerupdate(&tv, interval, frame); - if (timercmp(&ev->timestamp, &tv, >)) { + while (ev && !timercmp(&tv, &ev->timestamp, <)) { if (event_trigger(script->scene, ev) < 0) { goto error_event_trigger; } - ev = next; + ev = ev->next; } if ((readlen = xas_audio_stream_read(source, -- cgit v1.2.3