Skip to content

Possible bug: Weird crash, not sure the cause #187

@AndroidDeveloperLB

Description

@AndroidDeveloperLB
implementation("com.github.topjohnwu.libsu:core:6.0.0")

Got recently this crash from Crashlytics:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.io.OutputStream java.lang.Process.getOutputStream()' on a null object reference
       at com.topjohnwu.superuser.internal.ShellImpl$NoCloseOutputStream.<init>(ShellImpl.java:102)
       at com.topjohnwu.superuser.internal.ShellImpl.<init>(ShellImpl.java:123)
       at com.topjohnwu.superuser.internal.BuilderImpl.build(BuilderImpl.java:136)
       at com.topjohnwu.superuser.internal.BuilderImpl.exec(BuilderImpl.java:119)
       at com.topjohnwu.superuser.internal.Utils.setConfirmedRootState(Utils.java:78)
       at com.topjohnwu.superuser.internal.BuilderImpl.start(BuilderImpl.java:107)
       at com.topjohnwu.superuser.internal.BuilderImpl.build(BuilderImpl.java:158)
       at com.topjohnwu.superuser.NoShellException.<init>(NoShellException.java:27)
       at com.topjohnwu.superuser.internal.MainShell.get(MainShell.java:48)
       at com.topjohnwu.superuser.internal.MainShell.returnShell(MainShell.java:60)
       at com.topjohnwu.superuser.internal.MainShell.lambda$get$1(MainShell.java:74)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:923)

It doesn't show on the stacktrace anything about my app.
However, I have some logs I've reported before, which might help.

if (savedInstanceState == null) {
    val cachedShell = Shell.getCachedShell()
    if (cachedShell?.isRoot == false)
        cachedShell.close()
    viewModel.getRoot()
}

The getRoot is as such:

@UiThread
fun getRoot() {
    Shell.getShell {
        val hasRoot = it.isRoot
        liveData.value = StatefulData.Success(hasRoot)
    }
}

Sadly I don't know what was truly called here, but pretty sure it entered this block of code because that's the only place that uses the library at this point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions