From 7f66d556af8b2b4b04083db54f1e5cc916f32834 Mon Sep 17 00:00:00 2001 From: George Politis Date: Thu, 7 Oct 2021 14:09:23 +0200 Subject: [PATCH] fix: Prevents an NPE. The NPE might have been introduced in e66afe1ae243e713d96a6e56bbf75200ccab42ce --- .../java/org/jitsi/meet/test/base/AbstractBaseTest.java | 5 ++++- .../java/org/jitsi/meet/test/base/ParticipantHelper.java | 9 +++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/jitsi/meet/test/base/AbstractBaseTest.java b/src/test/java/org/jitsi/meet/test/base/AbstractBaseTest.java index 4263f8458..6334d1438 100644 --- a/src/test/java/org/jitsi/meet/test/base/AbstractBaseTest.java +++ b/src/test/java/org/jitsi/meet/test/base/AbstractBaseTest.java @@ -367,7 +367,10 @@ public void closeParticipant(P participant) @AfterClass public void cleanupClass() { - this.participants.cleanup(); + if (this.participants != null) + { + this.participants.cleanup(); + } } @BeforeMethod diff --git a/src/test/java/org/jitsi/meet/test/base/ParticipantHelper.java b/src/test/java/org/jitsi/meet/test/base/ParticipantHelper.java index 147f5abed..ff0e9cba9 100644 --- a/src/test/java/org/jitsi/meet/test/base/ParticipantHelper.java +++ b/src/test/java/org/jitsi/meet/test/base/ParticipantHelper.java @@ -190,8 +190,13 @@ public P get(int index) */ public void cleanup() { - participants.stream().forEach(Participant::closeSafely); - participants.clear(); + if (participants != null) + { + participants.stream() + .filter(participant -> participant != null) + .forEach(Participant::closeSafely); + participants.clear(); + } } /**