The SVDRP command DELC now refuses to delete the very last channel in the list

This commit is contained in:
Klaus Schmidinger
2016-12-08 09:53:01 +01:00
parent 1172937e8a
commit ce6c90a450
2 changed files with 8 additions and 2 deletions

View File

@@ -8828,7 +8828,7 @@ Video Disk Recorder Revision History
- Empty adaptation field TS packets are now skipped when recording (thanks to - Empty adaptation field TS packets are now skipped when recording (thanks to
Christopher Reimer, based on the "AFFcleaner" by Stefan P<>schel). Christopher Reimer, based on the "AFFcleaner" by Stefan P<>schel).
2016-11-07: Version 2.3.2 2016-12-08: Version 2.3.2
- Fixed a crash when deleting a recording (reported by Oliver Endriss). - Fixed a crash when deleting a recording (reported by Oliver Endriss).
- Fixed an overflow of PIDs in a receiver (thanks to Robert Hannebauer). - Fixed an overflow of PIDs in a receiver (thanks to Robert Hannebauer).
@@ -8837,3 +8837,5 @@ Video Disk Recorder Revision History
- The function SetCurrentChannel(const cChannel *Channel) is now deprecated and - The function SetCurrentChannel(const cChannel *Channel) is now deprecated and
may be removed in a future version. Use SetCurrentChannel(int ChannelNumber) may be removed in a future version. Use SetCurrentChannel(int ChannelNumber)
instead. instead.
- The SVDRP command DELC now refuses to delete the very last channel in the list,
to avoid ending up with an empty channel list.

View File

@@ -10,7 +10,7 @@
* and interact with the Video Disk Recorder - or write a full featured * and interact with the Video Disk Recorder - or write a full featured
* graphical interface that sits on top of an SVDRP connection. * graphical interface that sits on top of an SVDRP connection.
* *
* $Id: svdrp.c 4.9 2015/09/14 13:23:06 kls Exp $ * $Id: svdrp.c 4.10 2016/12/08 09:51:02 kls Exp $
*/ */
#include "svdrp.h" #include "svdrp.h"
@@ -1228,6 +1228,10 @@ void cSVDRPServer::CmdDELC(const char *Option)
int n = Channels->GetNextNormal(CurrentChannel->Index()); int n = Channels->GetNextNormal(CurrentChannel->Index());
if (n < 0) if (n < 0)
n = Channels->GetPrevNormal(CurrentChannel->Index()); n = Channels->GetPrevNormal(CurrentChannel->Index());
if (n < 0) {
Reply(501, "Can't delete channel \"%s\" - list would be empty", Option);
return;
}
CurrentChannel = Channels->Get(n); CurrentChannel = Channels->Get(n);
CurrentChannelNr = 0; // triggers channel switch below CurrentChannelNr = 0; // triggers channel switch below
} }