julian-klode / dns66

DNS-based Host Blocker (and lightweight ad blocker) for Android

Home Page:https://jak-linux.org/projects/dns66/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AdVpnThread.stopThread() on a null object reference

soenkegissel opened this issue · comments

The belows stacktrace occures when the Lists are getting updated and you start and stop the service by button click.

java.lang.NullPointerException: Attempt to invoke virtual method 'void org.jak_linux.dns66.vpn.AdVpnThread.stopThread()' on a null object reference
at org.jak_linux.dns66.vpn.AdVpnService.restartVpnThread(AdVpnService.java:232)
at org.jak_linux.dns66.vpn.AdVpnService.reconnect(AdVpnService.java:248)
at org.jak_linux.dns66.vpn.AdVpnService.connectivityChanged(AdVpnService.java:305)
at org.jak_linux.dns66.vpn.AdVpnService.handleMessage(AdVpnService.java:283)
at org.jak_linux.dns66.vpn.AdVpnService$MyHandler.handleMessage(AdVpnService.java:58)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

In AdVpnService line 255 is the vpnThread = null; really needed?
If you call line 264 stopSelf(); the vpnThread should be garbage collected as well.

I'm not going to try and find out if it's needed, it's there, so it probably is. Because this whole business is super messy with cycles and weird references in android system.