cec: ensure that there always is at least one device type set
authorLars Op den Kamp <lars@opdenkamp.eu>
Tue, 14 Feb 2012 14:40:28 +0000 (15:40 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Tue, 14 Feb 2012 14:40:28 +0000 (15:40 +0100)
src/lib/CECProcessor.cpp

index 0ec1ef7e9b6959322f1418aed6178aab71df7a38..cc9936edf667207f97c2ea8502b85d1e0009b304 100644 (file)
@@ -63,6 +63,8 @@ CCECProcessor::CCECProcessor(CLibCEC *controller, const libcec_configuration *co
     m_clientVersion(configuration->clientVersion),
     m_wakeDevices(configuration->wakeDevices)
 {
+  if (m_types.IsEmpty())
+    m_types.Add(CEC_DEVICE_TYPE_RECORDING_DEVICE);
   m_logicalAddresses.Clear();
   CreateBusDevices();
   if (configuration->tvVendor != CEC_VENDOR_UNKNOWN)
@@ -87,6 +89,8 @@ CCECProcessor::CCECProcessor(CLibCEC *controller, const char *strDeviceName, con
     m_iLastTransmission(0),
     m_clientVersion(clientVersion)
 {
+  if (m_types.IsEmpty())
+    m_types.Add(CEC_DEVICE_TYPE_RECORDING_DEVICE);
   m_wakeDevices.Clear();
   m_logicalAddresses.Clear();
   CreateBusDevices();
@@ -394,6 +398,12 @@ bool CCECProcessor::FindLogicalAddresses(void)
   bool bReturn(true);
   m_logicalAddresses.Clear();
 
+  if (m_types.IsEmpty())
+  {
+    CLibCEC::AddLog(CEC_LOG_ERROR, "no device types set");
+    return false;
+  }
+
   for (unsigned int iPtr = 0; iPtr < 5; iPtr++)
   {
     if (m_types.types[iPtr] == CEC_DEVICE_TYPE_RESERVED)