From ce6c90a4506a80bf7e8fa55d2ab643478e97183f Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Thu, 8 Dec 2016 09:53:01 +0100 Subject: The SVDRP command DELC now refuses to delete the very last channel in the list --- HISTORY | 4 +++- svdrp.c | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/HISTORY b/HISTORY index 58290393..503f7707 100644 --- a/HISTORY +++ b/HISTORY @@ -8828,7 +8828,7 @@ Video Disk Recorder Revision History - Empty adaptation field TS packets are now skipped when recording (thanks to 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 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 may be removed in a future version. Use SetCurrentChannel(int ChannelNumber) 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. diff --git a/svdrp.c b/svdrp.c index 1a24d296..81768e3e 100644 --- a/svdrp.c +++ b/svdrp.c @@ -10,7 +10,7 @@ * and interact with the Video Disk Recorder - or write a full featured * 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" @@ -1228,6 +1228,10 @@ void cSVDRPServer::CmdDELC(const char *Option) int n = Channels->GetNextNormal(CurrentChannel->Index()); if (n < 0) 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); CurrentChannelNr = 0; // triggers channel switch below } -- cgit v1.2.3