From 6a61b5ed7ad47d7119e26bc914bddc08f38947dc Mon Sep 17 00:00:00 2001 From: kamel5 Date: Thu, 15 Aug 2019 15:39:23 +0200 Subject: Fixed a loop in cLCARSNGDisplayChannel::DrawTimer --- displaychannel.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/displaychannel.c b/displaychannel.c index 687f9e7..112750f 100644 --- a/displaychannel.c +++ b/displaychannel.c @@ -300,11 +300,18 @@ void cLCARSNGDisplayChannel::DrawEventRec(const cEvent *Present, const cEvent *F void cLCARSNGDisplayChannel::DrawTimer(void) { + int CountTimers = 0; LOCK_TIMERS_READ; + for (const cTimer *Timer = Timers->First(); Timer; Timer = Timers->Next(Timer)) { + if (Timer->HasFlags(tfActive)) + CountTimers++; + } + if (CountTimers == 0) + return; cSortedTimers SortedTimers(Timers); int i = 0; int j = 0; - while (i < 3) { + while (i < min(CountTimers, 3)) { int y = yc05 + Margin + i * lineHeight + (i == 2 ? Margin : 0); if (const cTimer *Timer = SortedTimers[i + j]) { time_t Now = time(NULL); -- cgit v1.2.3