From b6c8276954ef1668191f81e801d48faacdd10b66 Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Tue, 4 Oct 2011 20:59:47 +0200 Subject: [PATCH] cec: check whether m_port isn't NULL in ReadFromDevice --- src/lib/AdapterCommunication.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/AdapterCommunication.cpp b/src/lib/AdapterCommunication.cpp index be94858..d56ee16 100644 --- a/src/lib/AdapterCommunication.cpp +++ b/src/lib/AdapterCommunication.cpp @@ -116,8 +116,6 @@ void *CAdapterCommunication::Process(void) CCondition::Sleep(50); } - m_controller->AddLog(CEC_LOG_DEBUG, "reader thread terminated"); - CLockObject lock(&m_commMutex); m_bStarted = false; return NULL; @@ -127,6 +125,9 @@ bool CAdapterCommunication::ReadFromDevice(int iTimeout) { uint8_t buff[1024]; CLockObject lock(&m_commMutex); + if (!m_port) + return false; + int iBytesRead = m_port->Read(buff, sizeof(buff), iTimeout); lock.Leave(); if (iBytesRead < 0) -- 2.34.1