summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/tree.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/apps/tree.c b/apps/tree.c
index b50dd5c826..5a8618babb 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -380,6 +380,21 @@ static int showdir(char *path, int start)
380 dirstart = start; 380 dirstart = start;
381 } 381 }
382 382
383 /* The cursor might point to an invalid line, for example if someone
384 deleted the last file in the dir */
385 if(filesindir)
386 {
387 while(start + dircursor >= filesindir)
388 {
389 if(start)
390 start--;
391 else
392 if(dircursor)
393 dircursor--;
394 }
395 dirstart = start;
396 }
397
383#ifdef HAVE_LCD_CHARCELLS 398#ifdef HAVE_LCD_CHARCELLS
384 lcd_stop_scroll(); 399 lcd_stop_scroll();
385 lcd_double_height(false); 400 lcd_double_height(false);
@@ -1119,6 +1134,7 @@ bool dirbrowse(char *root)
1119 1134
1120 if (restore || reload_dir) { 1135 if (restore || reload_dir) {
1121 /* restore display */ 1136 /* restore display */
1137
1122 /* We need to adjust if the number of lines on screen have 1138 /* We need to adjust if the number of lines on screen have
1123 changed because of a status bar change */ 1139 changed because of a status bar change */
1124 if(CURSOR_Y+LINE_Y+dircursor>tree_max_on_screen) { 1140 if(CURSOR_Y+LINE_Y+dircursor>tree_max_on_screen) {