don't crash LibCecSharp when receiving an alert with a NULL param (like the connectio...
authorLars Op den Kamp <lars@opdenkamp.eu>
Fri, 13 Dec 2013 10:22:46 +0000 (11:22 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Fri, 13 Dec 2013 10:22:46 +0000 (11:22 +0100)
src/LibCecSharp/CecSharpTypes.h

index 6dc324a9f191c9213b8c5c189036cdc39bd1b25f..78d01a953bc7b26bfbafd0e901f7ef3d110074ab 100644 (file)
@@ -2405,7 +2405,7 @@ namespace CecSharp
         CecParameterType newType = (CecParameterType)data.paramType;
         if (newType == CecParameterType::ParameterTypeString)
         {
-          System::String ^ newData = gcnew System::String((const char *)data.paramData, 0, 128);
+          System::String ^ newData = gcnew System::String(data.paramData ? (const char *)data.paramData : "", 0, 128);
           CecParameter ^ newParam = gcnew CecParameter(newType, newData);
           iReturn = m_callbacks->ReceiveAlert((CecAlert)alert, newParam);
         }