Fixed a crash when creating a new channel if the channel list is empty

This commit is contained in:
Klaus Schmidinger 2010-05-02 15:09:59 +02:00
parent c19c63530e
commit 88dc4e3351
4 changed files with 8 additions and 4 deletions

View File

@ -2397,6 +2397,7 @@ Halim Sahin <halim.sahin@t-online.de>
channel in the channel list channel in the channel list
for suggesting to make the "Source" item in the "Edit channel" menu wrap around the for suggesting to make the "Source" item in the "Edit channel" menu wrap around the
list of sources list of sources
for reporting a crash when creating a new channel if the channel list is empty
Denis Knauf <denis.knauf@gmail.com> Denis Knauf <denis.knauf@gmail.com>
for reporting a missing '-' at the next to last line of SVDRP help texts for reporting a missing '-' at the next to last line of SVDRP help texts

View File

@ -6448,3 +6448,5 @@ Video Disk Recorder Revision History
Thanks to Derek Kelly for testing this. Thanks to Derek Kelly for testing this.
- Updated the Ukrainian OSD texts (thanks to Yarema Aka Knedlyk). - Updated the Ukrainian OSD texts (thanks to Yarema Aka Knedlyk).
- Fixed handling "none" color entries in XPM files (thanks to Thomas Günther). - Fixed handling "none" color entries in XPM files (thanks to Thomas Günther).
- Fixed a crash when creating a new channel if the channel list is empty (reported
by Halim Sahin).

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: channels.c 2.13 2010/02/21 13:36:04 kls Exp $ * $Id: channels.c 2.14 2010/05/02 15:07:38 kls Exp $
*/ */
#include "channels.h" #include "channels.h"
@ -61,6 +61,7 @@ cChannel::cChannel(void)
provider = strdup(""); provider = strdup("");
portalName = strdup(""); portalName = strdup("");
memset(&__BeginData__, 0, (char *)&__EndData__ - (char *)&__BeginData__); memset(&__BeginData__, 0, (char *)&__EndData__ - (char *)&__BeginData__);
parameters = "";
modification = CHANNELMOD_NONE; modification = CHANNELMOD_NONE;
schedule = NULL; schedule = NULL;
linkChannels = NULL; linkChannels = NULL;

6
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 2.21 2010/03/12 16:03:07 kls Exp $ * $Id: menu.c 2.22 2010/05/02 14:28:26 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -212,14 +212,15 @@ cMenuEditChannel::cMenuEditChannel(cChannel *Channel, bool New)
sourceParam = NULL; sourceParam = NULL;
if (channel) { if (channel) {
data = *channel; data = *channel;
strn0cpy(name, data.name, sizeof(name));
if (New) { if (New) {
channel = NULL; channel = NULL;
data.nid = 0; data.nid = 0;
data.tid = 0; data.tid = 0;
data.rid = 0; data.rid = 0;
} }
Setup();
} }
Setup();
} }
void cMenuEditChannel::Setup(void) void cMenuEditChannel::Setup(void)
@ -229,7 +230,6 @@ void cMenuEditChannel::Setup(void)
Clear(); Clear();
// Parameters for all types of sources: // Parameters for all types of sources:
strn0cpy(name, data.name, sizeof(name));
Add(new cMenuEditStrItem( tr("Name"), name, sizeof(name))); Add(new cMenuEditStrItem( tr("Name"), name, sizeof(name)));
Add(new cMenuEditSrcItem( tr("Source"), &data.source)); Add(new cMenuEditSrcItem( tr("Source"), &data.source));
Add(new cMenuEditIntItem( tr("Frequency"), &data.frequency)); Add(new cMenuEditIntItem( tr("Frequency"), &data.frequency));