cec: fixed potential segfault in CCECProcessor::GetDeviceByPhysicalAddress()
authorLars Op den Kamp <lars@opdenkamp.eu>
Thu, 26 Apr 2012 11:07:24 +0000 (13:07 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Thu, 26 Apr 2012 11:07:24 +0000 (13:07 +0200)
src/lib/CECProcessor.cpp

index 9c04b423bb2b100b0d0b651b129206023c76e9a5..efe038f1498eb17f433fa0c7f8191673411dc031 100644 (file)
@@ -812,8 +812,11 @@ uint8_t CCECProcessor::MuteAudio(bool bSendRelease /* = true */)
 
 CCECBusDevice *CCECProcessor::GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress, bool bSuppressUpdate /* = true */)
 {
-  if (m_busDevices[m_configuration.logicalAddresses.primary]->GetPhysicalAddress() == iPhysicalAddress)
-    return m_busDevices[m_configuration.logicalAddresses.primary];
+  if (m_configuration.logicalAddresses.primary != CECDEVICE_UNKNOWN)
+  {
+    if (m_busDevices[m_configuration.logicalAddresses.primary]->GetPhysicalAddress() == iPhysicalAddress)
+      return m_busDevices[m_configuration.logicalAddresses.primary];
+  }
 
   CCECBusDevice *device = NULL;
   for (unsigned int iPtr = 0; iPtr < 16; iPtr++)