From 0bdc4bd32ff1c736100292046f4a2bd6e8486379 Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Sun, 11 Feb 2024 18:15:10 +0100 Subject: [PATCH] Fix for crash when no SPI memory available (#41) --- tactility/src/apps/system/system_info/system_info.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tactility/src/apps/system/system_info/system_info.c b/tactility/src/apps/system/system_info/system_info.c index cc41913a..086db8cf 100644 --- a/tactility/src/apps/system/system_info/system_info.c +++ b/tactility/src/apps/system/system_info/system_info.c @@ -48,7 +48,13 @@ static void add_memory_bar(lv_obj_t* parent, const char* label, size_t used, siz lv_obj_t* bar = lv_bar_create(container); lv_obj_set_flex_grow(bar, 1); - lv_bar_set_range(bar, 0, (int32_t)total); + + if (total > 0) { + lv_bar_set_range(bar, 0, (int32_t)total); + } else { + lv_bar_set_range(bar, 0, 1); + } + lv_bar_set_value(bar, (int32_t)used, 0); lv_obj_t* bottom_label = lv_label_create(parent);