diff options
author | Matti Lehtimäki <matti.lehtimaki@gmail.com> | 2014-08-23 09:59:54 +0200 |
---|---|---|
committer | Matti Lehtimäki <matti.lehtimaki@gmail.com> | 2014-08-23 09:59:54 +0200 |
commit | 55a4be45520177acb809b6b58f36a16bff3ab739 (patch) | |
tree | 3eead1e2958a7a84ceafce4a144b6504fb2c64c5 /epgclone.c | |
parent | ec36c62f4360daf9d39564e040ac4b181baf4316 (diff) | |
download | vdr-plugin-epgfixer-55a4be45520177acb809b6b58f36a16bff3ab739.tar.gz vdr-plugin-epgfixer-55a4be45520177acb809b6b58f36a16bff3ab739.tar.bz2 |
Fix crash when cloning to a non-existent channel, thanks to Guy Martin.
Automatically disable the cloning which causes an error.
Diffstat (limited to 'epgclone.c')
-rw-r--r-- | epgclone.c | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -48,11 +48,22 @@ void cEpgClone::CloneEvent(cEvent *Source, cEvent *Dest) { if (Source->Seen()) Dest->SetSeen(); tChannelID channelID; - if (dest_num) - channelID = Channels.GetByNumber(dest_num)->GetChannelID(); + if (dest_num) { + cChannel *dest_chan = Channels.GetByNumber(dest_num); + if (dest_chan) + channelID = Channels.GetByNumber(dest_num)->GetChannelID(); + else + channelID = tChannelID::InvalidID; + } else channelID = tChannelID::FromString(dest_str); - AddEvent(Dest, channelID); + if (channelID == tChannelID::InvalidID) { + enabled = false; + delete Dest; + error("Destination channel %s not found for cloning, disabling cloning!", (dest_num ? *itoa(dest_num) : dest_str)); + } + else + AddEvent(Dest, channelID); } bool cEpgClone::Apply(cEvent *Event) |