Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AndroidDeveloperLB opened this issue Sep 2, 2024 · 0 comments
Open

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

AndroidDeveloperLB opened this issue Sep 2, 2024 · 0 comments

Comments

@AndroidDeveloperLB
Copy link

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.

@AndroidDeveloperLB AndroidDeveloperLB changed the title Weird crash, not sure the cause Possible bug: Weird crash, not sure the cause Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant