Skip to content

NPE after inboundClient.option().removeListener(listener) #41

@fa11er

Description

@fa11er

When I delete a listener, I sometimes get a NullPointerException. As I understand it, this happens when the event has already been sent to the listener and he has left at that moment. Is this a bug or is there a safe way to remove the listener?

ERROR - Error caught notifying listener of event [EslEvent: name=[CHANNEL_HANGUP] headers=2, eventHeaders=112, eventBody=0 lines.], remote address [127.0.0.1:8021]
java.lang.NullPointerException: Cannot invoke "link.thingscloud.freeswitch.esl.IEslEventListener.eventReceived(String, link.thingscloud.freeswitch.esl.transport.event.EslEvent)" because "lis
tener" is null
        at link.thingscloud.freeswitch.esl.inbound.AbstractInboundClient.lambda$handleEslEvent$6(AbstractInboundClient.java:222)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at link.thingscloud.freeswitch.esl.inbound.AbstractInboundClient.handleEslEvent(AbstractInboundClient.java:190)
        at link.thingscloud.freeswitch.esl.inbound.NettyInboundClient.handleEslEvent(NettyInboundClient.java:41)
        at link.thingscloud.freeswitch.esl.inbound.handler.InboundChannelHandler.lambda$handleEslEvent$4(InboundChannelHandler.java:174)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:840)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions