summaryrefslogtreecommitdiff
path: root/channelgroups.c
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2015-03-15 14:49:39 +0100
committerlouis <louis.braun@gmx.de>2015-03-15 14:49:39 +0100
commit108d8e57849f43f7728fd748a3162abba7b95c9a (patch)
treea893a7b9589decb9a72f9b807b3d347713844173 /channelgroups.c
parent439d3e36cc65bd074bd0e1a1c2b6b6cc4aa392b2 (diff)
downloadvdr-plugin-tvguideng-108d8e57849f43f7728fd748a3162abba7b95c9a.tar.gz
vdr-plugin-tvguideng-108d8e57849f43f7728fd748a3162abba7b95c9a.tar.bz2
fixed crash if a channel group is empty
Diffstat (limited to 'channelgroups.c')
-rw-r--r--channelgroups.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/channelgroups.c b/channelgroups.c
index 42a36b1..70cecf1 100644
--- a/channelgroups.c
+++ b/channelgroups.c
@@ -5,8 +5,8 @@
cChannelGroup::cChannelGroup(string name, int id) {
this->id = id;
- channelStart = 0;
- channelStop = 0;
+ channelStart = -1;
+ channelStop = -1;
this->name = name;
}
@@ -54,6 +54,19 @@ void cChannelgroups::Init(void) {
if (channelGroups.size() > 0) {
channelGroups[channelGroups.size()-1].SetChannelStop(lastChannelNumber);
}
+ //cleanup empty groups
+ bool foundDelete = false;
+ do {
+ for (vector<cChannelGroup>::iterator it = channelGroups.begin(); it != channelGroups.end(); it++) {
+ cChannelGroup group = *it;
+ if (group.StartChannel() == 0 || group.StartChannel() == -1) {
+ channelGroups.erase(it);
+ foundDelete = true;
+ break;
+ }
+ foundDelete = false;
+ }
+ } while (foundDelete);
}
void cChannelgroups::Clear(void) {