Wowza Community

NullPointerException while getting WebRTCSession counts for a stream

Hi,

I have created a module to meet a specific use-case where I disconnect any unused RTSP camera stream in WSE by checking periodically if there are any outbound WebRTC sessions for the stream.
Whenever I execute the following line of code, I get the correct WebRTC sessions count for the stream but in the log file a NullPointerException is thrown.

 public void checkOutBoundConnections(IApplicationInstance appInstance, String streamName) {
		int webRTCSessions = appInstance.getWebRTCSessionCount(streamName);
        /*  
        Rest of the code 
       */
}

The corresponing log messages are shown below

ApplicationInstance.getRTPSessionCount : java.lang.NullPointerException|at com.wowza.wms.application.ApplicationInstance.getWebRTCSessionCount(ApplicationInstance.java:3076)|at com.wowza.module.StreamOnDemandModule.checkOutBoundConnections(StreamOnDemandModule.java:37)|at com.wowza..module.StreamOnDemandModule.onStreamDestroy(StreamOnDemandModule.java:30)|at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)|at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)|at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)|at java.base/java.lang.reflect.Method.invoke(Method.java:566)|at com.wowza.wms.module.ModuleFunction.invoke(ModuleFunction.java:422)|at com.wowza.wms.module.ModuleFunctions.a(ModuleFunctions.java:714)|at com.wowza.wms.module.ModuleFunctions.onStreamDestroy(ModuleFunctions.java:768)|at com.wowza.wms.stream.MediaStreamMap.a(MediaStreamMap.java:793)|at com.wowza.wms.stream.MediaStreamMap.removeStream(MediaStreamMap.java:769)|at com.wowza.wms.rtp.model.RTPStream.shutdown(RTPStream.java:1124)|at com.wowza.wms.rtp.model.RTPSession.shutdown(RTPSession.java:280)|

I am not understanding why it is giving me a response if NullPointerException is thrown ?