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;