From 6a8593918b23583bca53acedf11d57b53824d4e2 Mon Sep 17 00:00:00 2001 From: Gamgie Date: Wed, 21 Dec 2022 22:27:03 +0100 Subject: [PATCH] fix bug when not finding a key while sending feedback --- Runtime/OSCQuery.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Runtime/OSCQuery.cs b/Runtime/OSCQuery.cs index 98a5078..cb5249e 100644 --- a/Runtime/OSCQuery.cs +++ b/Runtime/OSCQuery.cs @@ -641,7 +641,7 @@ bool checkFilteredComp(String typeString) void ProcessIncomingMessages() { - while (receiver.hasWaitingMessages()) + while (receiver != null && receiver.hasWaitingMessages()) { OSCMessage msg = receiver.getNextMessage(); @@ -782,6 +782,12 @@ void ProcessIncomingMessages() void sendFeedback(string address, WSQuery query) { + if (!compInfoMap.ContainsKey(address)) + { + Debug.Log("Address " + address + " is not registered, skipping feedback"); + return; + } + CompInfo info = compInfoMap[address]; object oldData = null; @@ -797,7 +803,8 @@ void sendFeedback(string address, WSQuery query) if (data == null) return; - propQueryPreviousValues[address] = data; + if (!propQueryPreviousValues.ContainsKey(address)) propQueryPreviousValues.Add(address, data); + else propQueryPreviousValues[address] = data; OSCMessage m = new OSCMessage(address);