diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/gui/line.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/apps/gui/line.c b/apps/gui/line.c index fe017970e6..fd35102ab0 100644 --- a/apps/gui/line.c +++ b/apps/gui/line.c | |||
@@ -51,9 +51,17 @@ static void put_text(struct screen *display, int x, int y, struct line_desc *lin | |||
51 | const char *text, bool prevent_scroll, int text_skip_pixels); | 51 | const char *text, bool prevent_scroll, int text_skip_pixels); |
52 | 52 | ||
53 | struct line_desc_scroll { | 53 | struct line_desc_scroll { |
54 | struct line_desc desc; /* must be first! */ | 54 | struct line_desc desc; |
55 | bool used; | 55 | bool used; |
56 | } lines[MAX_LINES]; | 56 | }; |
57 | |||
58 | /* Allocate MAX_LINES+1 because at the time get_line_desc() is called | ||
59 | * the scroll engine did not yet determine that it ran out of lines | ||
60 | * (because puts_scroll_func() wasn't called yet. Therefore we can | ||
61 | * run out of lines before setting the used field. By allocating | ||
62 | * one item more we can survive that point and set used to false | ||
63 | * if the scroll engine runs out of lines */ | ||
64 | static struct line_desc_scroll lines[MAX_LINES+1]; | ||
57 | 65 | ||
58 | static struct line_desc_scroll *get_line_desc(void) | 66 | static struct line_desc_scroll *get_line_desc(void) |
59 | { | 67 | { |