From c7d18804da14cce58374636d4b7098cea027c5f0 Mon Sep 17 00:00:00 2001 From: Willy-JL <49810075+Willy-JL@users.noreply.github.com> Date: Fri, 22 Mar 2024 19:19:55 +0000 Subject: [PATCH] Proper fix for textbox UART hang/crash THANK YOU @0xchocolate --- applications/services/gui/modules/text_box.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/applications/services/gui/modules/text_box.c b/applications/services/gui/modules/text_box.c index 4243df19e..7059d356a 100644 --- a/applications/services/gui/modules/text_box.c +++ b/applications/services/gui/modules/text_box.c @@ -104,9 +104,7 @@ static void text_box_insert_endline(Canvas* canvas, TextBoxModel* model) { if(model->focus == TextBoxFocusEnd && line_num > lines_on_screen) { // Set text position to 5th line from the end const char* end = model->text + furi_string_size(model->text_formatted); - // TODO: Find proper fix, this prevents BusFault but hangs GUI after another while? makes no sense - for(uint8_t i = 0; i < line_num - lines_on_screen; i++) { - // Debugger shows it's stuck in this loop, but it also shows the while condition is false?? + for(size_t i = 0; i < line_num - lines_on_screen; i++) { while(model->text_pos < end) { if(*model->text_pos++ == '\n') break; }