openvidu-test-browsers: fix possible NullPointer on CustomWebhook#waitForNextEventToBeOfType

pull/711/head
pabloFuente 2022-03-28 20:04:35 +02:00
parent 7ac3139e44
commit bba002c046
1 changed files with 5 additions and 0 deletions

View File

@ -101,6 +101,11 @@ public class CustomWebhook {
throw new Exception("Wrong event type receieved. Excpeceted " + eventName + " but got " + ev); throw new Exception("Wrong event type receieved. Excpeceted " + eventName + " but got " + ev);
} else { } else {
// Remove the very same event from the map of events // Remove the very same event from the map of events
long maxWait = System.currentTimeMillis();
do {
Thread.sleep(25);
} while (!CustomWebhook.events.containsKey(eventName)
|| (System.currentTimeMillis() - maxWait) < (maxSecondsWait * 1000));
if (!CustomWebhook.events.get(eventName).contains(event)) { if (!CustomWebhook.events.get(eventName).contains(event)) {
throw new Exception("Lack of event " + eventName); throw new Exception("Lack of event " + eventName);
} else { } else {