From 6e5d8424fb7c79a4de02f7f7dedcb6445cecfca0 Mon Sep 17 00:00:00 2001 From: Paul Gregoire Date: Tue, 1 Aug 2017 09:56:07 -0700 Subject: [PATCH] Fixed handling for null broadcast scope on unregister --- .../org/red5/server/stream/ProviderService.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/red5/server/stream/ProviderService.java b/src/main/java/org/red5/server/stream/ProviderService.java index 9be03e21f..884bdf4d5 100644 --- a/src/main/java/org/red5/server/stream/ProviderService.java +++ b/src/main/java/org/red5/server/stream/ProviderService.java @@ -169,13 +169,15 @@ public boolean unregisterBroadcastStream(IScope scope, String name, IBroadcastSt if (bs != null) { log.debug("Unsubscribing scope {} from provider {}", broadcastScope, bs.getProvider()); broadcastScope.unsubscribe(bs.getProvider()); - } - // if the scope has no listeners try to remove it - if (!((BasicScope) broadcastScope).hasEventListeners()) { - if (log.isDebugEnabled()) { - log.debug("Scope has no event listeners attempting removal"); - } - scope.removeChildScope(broadcastScope); + // if the scope has no listeners try to remove it + if (!((BasicScope) broadcastScope).hasEventListeners()) { + if (log.isDebugEnabled()) { + log.debug("Scope has no event listeners attempting removal"); + } + scope.removeChildScope(broadcastScope); + } + } else { + log.debug("Broadcast scope was null for {}", name); } // verify that scope was removed return scope.getBasicScope(ScopeType.BROADCAST, name) == null;