Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

PluginPCCEventHandler thread crash with NullPointerException

Avatar
RankRankRankRank

Total Posts: 149

Joined 2014-04-02

PM

While connected to SimulANT+ for all types of bike power meter and speed/cadence sensors(default settings), I experienced this crash:

E/AndroidRuntime(2109): FATAL EXCEPTION: PluginPCCEventHandler
E/AndroidRuntime(2109): java.lang.NullPointerException
E/AndroidRuntime(2109): at com.dsi.ant.plugins.antplus.pcc.AntPlusBikePowerPcc.handlePluginEvent(AntPlusBikePowerPcc.java:2104)
E/AndroidRuntime(2109): at com.dsi.ant.plugins.antplus.pccbase.AntPluginPcc$3.handleMessage(AntPluginPcc.java:758)
E/AndroidRuntime(2109): at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime(2109): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(2109): at android.os.HandlerThread.run(HandlerThread.java:60)


What's going on?

Thanks.
R      

Signature

blackramlabs.com

Avatar
RankRankRankRank

Total Posts: 149

Joined 2014-04-02

PM

Bump.

Anyone looking at this?      

Signature

blackramlabs.com

RankRankRankRank

Total Posts: 313

Joined 2011-09-12

PM

Noticed this wasn't replied to here.

Looking at the code, the event handling code is not locked against changing the event receiver in this case. This error would occur at certain timings if you unsubscribe the event receiver during an event being processed. For now, an easy way to avoid this problem is by not unsubscribing from events unless the device is dead or released. You can re-subscribe with an empty method to work around this.      

Signature

Dynastream Developer

Avatar
RankRankRankRank

Total Posts: 149

Joined 2014-04-02

PM

Which case is "this case"?

I use:
antPlusBikePowerPcc.subscribeCalculatedTorqueEvent(null); 
and
antPlusBikePowerPcc.subscribeCalculatedPowerEvent(null); 

so I would like to only have to work around the broken one.

Thanks.
R      

Signature

blackramlabs.com

RankRankRankRank

Total Posts: 313

Joined 2011-09-12

PM

All of the BikePowerPCC event handling code is susceptible to this bug. So both events you mention are included. As I said before I would suggest subscribing with a blank method or waiting until release as the recommended behaviour.      

Signature

Dynastream Developer

Rank

Total Posts: 2

Joined 2016-09-22

PM

Any idea when this bug is going to be fixed? The code is just plain wrong. Bad in fact.      
RankRankRankRank

Total Posts: 313

Joined 2011-09-12

PM

The functions were not designed to be called more than once. Null as a callback is bad params in this case. Unfortunately for your request, there is no update to allow null params coming in the near future.      

Signature

Dynastream Developer

Rank

Total Posts: 2

Joined 2016-09-22

PM

The official documentation for all of the "subscribeXXX" functions that I have looked at states quite clearly: "This function can also be used to unsubscribe from an event, by passing null as the receiver."