cec: ensure that there always is at least one device type set
[deb_libcec.git] / 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)