NullPointerException in onClosed for Threaded Shell
Hi
We're experiencing a crash, coming from Shell object, that happens sporadically, but on many devices (+100 devices). The crash is seen with the newest version of the lib, i.e. "eu.chainfire:libsuperuser:1.1.0.202004101746"
The stacktrace is as following:
Fatal Exception: java.lang.NullPointerException
Attempt to invoke virtual method 'boolean java.lang.Thread.isAlive()' on a null object reference
eu.chainfire.libsuperuser.Shell$Threaded.onClosed (Shell.java:2884)
eu.chainfire.libsuperuser.Shell$Interactive.runNextCommand (Shell.java:1876)
eu.chainfire.libsuperuser.Shell$Interactive.runNextCommand (Shell.java:1726)
eu.chainfire.libsuperuser.Shell$Interactive.access$3700 (Shell.java:1526)
eu.chainfire.libsuperuser.Shell$Interactive$6.onStreamClosed (Shell.java:2119)
eu.chainfire.libsuperuser.StreamGobbler.run (StreamGobbler.java:169)
Looking at Shell.java:2884 it's obvious that it will produce a nullPointer (possibly in multiple following lines as well) if the handlerThread field variable is null.
Unfortunately I have not been able to reproduce the crash myself. I have also not been able to logically walk through the Shell code to understand how onClosed may be called while handlerThread is still null, or how it could somehow become a null object before the final statement is reached in onClosed. My best guess would therefore be a couple of simple null checks, which I assume would be safe in terms of quitting the thread, as it presumably would not exist or already have been GC in that case.
Any help or possible fix would be greatly appreciated, thanks! :)
what is your kernal?
Hi, I'm not sure how the kernel of the devices that experience this issue are relevant - can you elaborate on that?