NPE on attempting to access requests list in handlePresenceAnnouncement()
Closed this issue · 2 comments
markrebhan commented
Version 2.4.3
java.lang.NullPointerException: Attempt to invoke interface method 'boolean java.util.List.add(java.lang.Object)' on a null object reference
at io.resourcepool.ssdp.client.impl.SsdpClientImpl.handlePresenceAnnouncement(SsdpClientImpl.java:211)
at io.resourcepool.ssdp.client.impl.SsdpClientImpl.handleIncomingPacket(SsdpClientImpl.java:151)
at io.resourcepool.ssdp.client.impl.SsdpClientImpl.access$300(SsdpClientImpl.java:36)
at io.resourcepool.ssdp.client.impl.SsdpClientImpl$3.run(SsdpClientImpl.java:124)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
Taking a quick peak at SsdpClientImpl
, seems that there is a race somewhere because handlePresenceAnnouncement() is called when the requests
List is null
. At the very least, a null check should be added here (or migrated to Kotlin 😄 ).
loicortola commented
Hi!
Yup, seems like it. Will fix this weekend and release
loicortola commented
Hello @markrebhan
I saw only one possibility for this race condition to happen and fixed it.
I would love your feedback when trying 2.4.5 to make sure we don't have this issue anymore.
Let me know ;)