diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2011-07-31 13:48:49 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2011-07-31 13:48:49 +0200 |
commit | 4278458e69cbc785975bcd5f27c4ce98ac1381b8 (patch) | |
tree | f33fb4b4ada0b93fe4d37de05a08728569608f76 /vdr.c | |
parent | 404124eca463c5ba8ce76b1b3ca4e9454eeee7d4 (diff) | |
download | vdr-4278458e69cbc785975bcd5f27c4ce98ac1381b8.tar.gz vdr-4278458e69cbc785975bcd5f27c4ce98ac1381b8.tar.bz2 |
Now checking Setup.InitialChannel for NULL before using it
Diffstat (limited to 'vdr.c')
-rw-r--r-- | vdr.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -22,7 +22,7 @@ * * The project's page is at http://www.tvdr.de * - * $Id: vdr.c 2.21 2011/06/13 14:40:12 kls Exp $ + * $Id: vdr.c 2.22 2011/07/31 13:42:53 kls Exp $ */ #include <getopt.h> @@ -704,12 +704,14 @@ int main(int argc, char *argv[]) if (!cDevice::WaitForAllDevicesReady(DEVICEREADYTIMEOUT)) dsyslog("not all devices ready after %d seconds", DEVICEREADYTIMEOUT); - if (isnumber(Setup.InitialChannel)) { // for compatibility with old setup.conf files - if (cChannel *Channel = Channels.GetByNumber(atoi(Setup.InitialChannel))) - Setup.InitialChannel = Channel->GetChannelID().ToString(); + if (*Setup.InitialChannel) { + if (isnumber(Setup.InitialChannel)) { // for compatibility with old setup.conf files + if (cChannel *Channel = Channels.GetByNumber(atoi(Setup.InitialChannel))) + Setup.InitialChannel = Channel->GetChannelID().ToString(); + } + if (cChannel *Channel = Channels.GetByChannelID(tChannelID::FromString(Setup.InitialChannel))) + Setup.CurrentChannel = Channel->Number(); } - if (cChannel *Channel = Channels.GetByChannelID(tChannelID::FromString(Setup.InitialChannel))) - Setup.CurrentChannel = Channel->Number(); if (Setup.InitialVolume >= 0) Setup.CurrentVolume = Setup.InitialVolume; Channels.SwitchTo(Setup.CurrentChannel); |