crashfix: handle bad OSC message

This commit is contained in:
monsieurgustav
2015-02-04 20:56:09 +01:00
parent 54bb9feacb
commit 852682cd6f
2 changed files with 17 additions and 5 deletions
+2
View File
@@ -34,6 +34,8 @@ namespace UnrealBuildTool.Rules
"OSC/Private/Send", "OSC/Private/Send",
} }
); );
bEnableExceptions = true;
} }
} }
} }
@@ -140,14 +140,24 @@ static void SendBundle(TCircularQueue<std::pair<FName, TArray<FOscDataElemStruct
void UOscDispatcher::Callback(const FArrayReaderPtr& data, const FIPv4Endpoint&) void UOscDispatcher::Callback(const FArrayReaderPtr& data, const FIPv4Endpoint&)
{ {
UE_LOG(LogOSC, Verbose, TEXT("OSC Received")); UE_LOG(LogOSC, Verbose, TEXT("OSC Received"));
const osc::ReceivedPacket packet((const char *)data->GetData(), data->Num()); try
if(packet.IsBundle())
{ {
SendBundle(_pendingMessages, osc::ReceivedBundle(packet)); const osc::ReceivedPacket packet((const char *)data->GetData(), data->Num());
if(packet.IsBundle())
{
SendBundle(_pendingMessages, osc::ReceivedBundle(packet));
}
else
{
SendMessage(_pendingMessages, osc::ReceivedMessage(packet));
}
} }
else catch(osc::Exception &e)
{ {
SendMessage(_pendingMessages, osc::ReceivedMessage(packet)); // Exceptions are disabled by default, so destructors are not called.
// We don't care: there is no acquired resource to release.
const FString wide(e.what());
UE_LOG(LogOSC, Warning, TEXT("OSC Message Error: %s"), *wide);
} }
if(!_pendingMessages.IsEmpty()) if(!_pendingMessages.IsEmpty())