1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed a segfault in the Schedule menu in case there is no EPG information

This commit is contained in:
Klaus Schmidinger 2001-03-18 10:16:56 +01:00
parent 1966a15876
commit 191fb910bf

40
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: menu.c 1.69 2001/03/04 11:37:22 kls Exp $ * $Id: menu.c 1.70 2001/03/18 10:16:56 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -1425,23 +1425,27 @@ eOSState cMenuSchedule::ProcessKey(eKeys Key)
if (state == osUnknown) { if (state == osUnknown) {
switch (Key) { switch (Key) {
case kRed: return Record(); case kRed: return Record();
case kGreen: { case kGreen: if (schedules) {
if (!now && !next) { if (!now && !next) {
int ChannelNr = 0; int ChannelNr = 0;
if (Count()) { if (Count()) {
cChannel *channel = Channels.GetByServiceID(((cMenuScheduleItem *)Get(Current()))->eventInfo->GetServiceID()); cChannel *channel = Channels.GetByServiceID(((cMenuScheduleItem *)Get(Current()))->eventInfo->GetServiceID());
if (channel) if (channel)
ChannelNr = channel->number; ChannelNr = channel->number;
} }
now = true; now = true;
return AddSubMenu(new cMenuWhatsOn(schedules, true, ChannelNr)); return AddSubMenu(new cMenuWhatsOn(schedules, true, ChannelNr));
} }
now = !now; now = !now;
next = !next; next = !next;
return AddSubMenu(new cMenuWhatsOn(schedules, now, cMenuWhatsOn::CurrentChannel())); return AddSubMenu(new cMenuWhatsOn(schedules, now, cMenuWhatsOn::CurrentChannel()));
} }
case kYellow: return AddSubMenu(new cMenuWhatsOn(schedules, false, cMenuWhatsOn::CurrentChannel())); case kYellow: if (schedules)
case kBlue: return Switch(); return AddSubMenu(new cMenuWhatsOn(schedules, false, cMenuWhatsOn::CurrentChannel()));
break;
case kBlue: if (Count())
return Switch();
break;
case kOk: if (Count()) case kOk: if (Count())
return AddSubMenu(new cMenuEvent(((cMenuScheduleItem *)Get(Current()))->eventInfo, otherChannel)); return AddSubMenu(new cMenuEvent(((cMenuScheduleItem *)Get(Current()))->eventInfo, otherChannel));
break; break;