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,6 +140,8 @@ 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"));
try
{
const osc::ReceivedPacket packet((const char *)data->GetData(), data->Num()); const osc::ReceivedPacket packet((const char *)data->GetData(), data->Num());
if(packet.IsBundle()) if(packet.IsBundle())
{ {
@@ -149,6 +151,14 @@ void UOscDispatcher::Callback(const FArrayReaderPtr& data, const FIPv4Endpoint&)
{ {
SendMessage(_pendingMessages, osc::ReceivedMessage(packet)); SendMessage(_pendingMessages, osc::ReceivedMessage(packet));
} }
}
catch(osc::Exception &e)
{
// 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())
{ {