From 2e5b54c509509a331f575b5f0ba67c65bc162ff3 Mon Sep 17 00:00:00 2001 From: satbaby Date: Thu, 31 Jan 2013 16:18:05 +0100 Subject: [PATCH] src/gui/channellist.cpp: fix possible segfault --- src/gui/channellist.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index d643bca1b..a2641d25d 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -2126,12 +2126,15 @@ void CChannelList::paint_events(int index) do { //printf("%d seconds in the past - deleted %s\n", dif, e->description.c_str()); - if(!evtlist.empty()) - e = evtlist.erase(e); + e = evtlist.erase( e ); + if (e == evtlist.end()) + break; dif = azeit - e->startTime; } - while (!evtlist.empty() && dif > 0 ); + while ( dif > 0 ); } + if (e == evtlist.end()) + break; //Display the remaining events struct tm *tmStartZeit = localtime(&e->startTime); strftime(text1, sizeof(text1), "%H:%M", tmStartZeit );