From: Lars Op den Kamp Date: Tue, 4 Oct 2011 18:59:47 +0000 (+0200) Subject: cec: check whether m_port isn't NULL in ReadFromDevice X-Git-Tag: upstream/2.2.0~1^2~292 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=b6c8276954ef1668191f81e801d48faacdd10b66;p=deb_libcec.git cec: check whether m_port isn't NULL in ReadFromDevice --- 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)