From a7d4a6322c04fe293660c1c1345dbcd0f2bf0f06 Mon Sep 17 00:00:00 2001 From: nova Date: Thu, 14 May 2026 19:54:51 +0200 Subject: [PATCH] fix of a very rare edgecase in which thread_top get the wrong mid_dir.current_file->file_name --- interactions.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/interactions.c b/interactions.c index fe7a6e7..702f662 100644 --- a/interactions.c +++ b/interactions.c @@ -187,15 +187,19 @@ void dir_changed(){ } void move_down(unsigned long passes){ - /*bounds checking happens within thread_mid*/ mid_dir.current_file += passes; + if (mid_dir.current_file > mid_dir.file_list + mid_dir.file_count - 1) { + mid_dir.current_file = mid_dir.file_list + mid_dir.file_count - 1; + } status |= (STATUS_RUN_BACKEND); } void move_up(unsigned long passes){ - /*bounds checking happens within thread_mid*/ mid_dir.current_file -= passes; + if (mid_dir.current_file < mid_dir.file_list) { + mid_dir.current_file = mid_dir.file_list; + } status |= (STATUS_RUN_BACKEND); }