java-native / jssc

Java library for talking to serial ports (with added build support for maven, cmake, MSVC)
https://discord.gg/RBsUfE9sX9
GNU Lesser General Public License v3.0
170 stars 53 forks source link

Exception about removeEventListener #123

Open HughWick opened 2 years ago

HughWick commented 2 years ago

I tried to remove the EventListener after getting the serialPort object in another class and found an exception, the final reason is that I did not add the EventListener beforehand, I tried to use the getEventListener (there is no such method) or the getEventListenerAdded flag

//but the variable is private
 private boolean eventListenerAdded = false;

to get if there is currently an EventListener event.

Is there something I'm doing wrong?

Can you add a flag function to get whether there is currently an EventListener in the next version