diff --git a/desmume/src/libretro-common/rthreads/rthreads.c b/desmume/src/libretro-common/rthreads/rthreads.c index 4122ed4a8..31892c372 100644 --- a/desmume/src/libretro-common/rthreads/rthreads.c +++ b/desmume/src/libretro-common/rthreads/rthreads.c @@ -396,11 +396,11 @@ void scond_wait(scond_t *cond, slock_t *lock) /* add ourselves to a queue of waiting threads */ struct QueueEntry myentry; - myentry.next = NULL; - struct QueueEntry** ptr = &cond->head; + struct QueueEntry** ptr = &cond->head; while(*ptr) /* walk to the end of the linked list */ ptr = &((*ptr)->next); *ptr = &myentry; + myentry.next = NULL; cond->waiters++;