From 1e9e200e8a9e781d5cdc8da8a5ac7d2cad49144c Mon Sep 17 00:00:00 2001
From: schmirl <schmirl>
Date: Fri, 2 Mar 2007 15:27:07 +0000
Subject: Fixed null pointers

---
 server/connectionVTP.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/server/connectionVTP.c b/server/connectionVTP.c
index b66d224..18ea353 100644
--- a/server/connectionVTP.c
+++ b/server/connectionVTP.c
@@ -1,5 +1,5 @@
 /*
- *  $Id: connectionVTP.c,v 1.7 2005/05/09 20:22:29 lordjaxom Exp $
+ *  $Id: connectionVTP.c,v 1.8 2007/03/02 15:27:07 schmirl Exp $
  */
  
 #include "server/connectionVTP.h"
@@ -168,10 +168,17 @@ bool cLSTEHandler::Next(bool &Last)
 		if (m_Schedule != NULL) {
 			cChannel *channel = Channels.GetByChannelID(m_Schedule->ChannelID(),
 			                                            true);
-			m_State = Event;
-			return m_Client->Respond(-215, "C %s %s", 
+			if (channel != NULL) {
+				m_State = Event;
+				return m_Client->Respond(-215, "C %s %s", 
 			                         *channel->GetChannelID().ToString(),
 			                         channel->Name());
+			} else {
+				esyslog("ERROR: vdr streamdev: unable to find channel %s by ID",
+					         *m_Schedule->ChannelID().ToString());
+				m_State = EndChannel;
+				return Next(Last);
+			}
 		} else {
 			m_State = EndEPG;
 			return Next(Last);
@@ -796,7 +803,11 @@ bool cConnectionVTP::CmdLSTX(cHandler *&Handler, char *Option)
 		Handler = new cHandler(this, Option);
 	}
 
-	bool last, result = Handler->Next(last);
+	bool last, result = false;
+	if (Handler != NULL)
+		result = Handler->Next(last);
+	else
+		esyslog("ERROR: vdr streamdev: Handler in LSTX command is NULL");
 	if (!result || last)
 		DELETENULL(Handler);
 
-- 
cgit v1.2.3