[Magisk] fhmehfcekfek:
Magisk Manager keeps crashing

Hello, thanks for your excellent work John!

Unfortunately MagiskManager 5.6.4 is crashing every time I (or an app requesting root on my behalf) open it. I believe (not sure) that this began after I installed the March 5th security update for Android 8.1.0 on my Pixel. Certainly, I have previously had Magisk Manager working on this device. Downgrading to Magisk Manager 5.6.3 or 5.6.2 made no difference.

From logcat (included below), it looks like the app is attempting to access a null value as if it were a valid string. This commonly happens when a developer forgot to check for a null return value from a method with return type java.lang.String.

I'm a competent Java developer with some Android dev experience, so would be happy to debug this, but a) I suspect it's an easy bug to fix, and b) I suspect it's merely a cascade error that's hiding a more interesting problem.

From the looks of it, Magisk Manager was unable to open the database of permitted/denied apps, for some reason currently unknown.

I'll take a look at your Java code now - I may send you a merge request or open an issue or something over there, unless you have a better idea.

04-02 12:55:33.116 916 932 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.topjohnwu.magisk/.SplashActivity bnds=[439,252][641,514]} from uid 10031
04-02 12:55:33.137 684 684 D QCOM PowerHAL: LAUNCH HINT: ON
04-02 12:55:33.139 684 684 D QCOM PowerHAL: Activity launch hint handled
04-02 12:55:33.161 916 932 I ActivityManager: Start proc 17432:com.topjohnwu.magisk/u0a272 for activity com.topjohnwu.magisk/.SplashActivity
04-02 12:55:33.283 671 671 D sound_trigger_hw: stdev_stop_recognition:[2] Enter
04-02 12:55:33.283 671 671 D sound_trigger_hw: dereg_hal_event_session: ST_EVENT_SESSION_DEREGISTER capture_handle 366 pcm 0xee0b44c0
04-02 12:55:33.283 671 671 I sound_trigger_hw: cpe_stop:[2] Enter
04-02 12:55:33.299 671 671 D sound_trigger_hw: cpe_stop:[2] Exit, status=0
04-02 12:55:33.299 671 671 D sound_trigger_hw: sound_trigger_set_device: disable device (1) = listen-cpe-handset-mic
04-02 12:55:33.304 671 671 D sound_trigger_hw: cpe_dereg_sm_params:[2] Enter
04-02 12:55:33.304 671 671 D sound_trigger_hw: stdev_stop_recognition:[2] Exit status 0
04-02 12:55:33.306 12146 12146 I GsaVoiceInteractionSrv: Stop Hotword Recognition status: true
04-02 12:55:34.183 17432 17432 D AndroidRuntime: Shutting down VM
--------- beginning of crash
04-02 12:55:34.184 17432 17432 E AndroidRuntime: FATAL EXCEPTION: main
04-02 12:55:34.184 17432 17432 E AndroidRuntime: Process: com.topjohnwu.magisk, PID: 17432
04-02 12:55:34.184 17432 17432 E AndroidRuntime: java.lang.RuntimeException: Unable to create application com.topjohnwu.magisk.MagiskManager: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String[] java.lang.String.split(java.lang.String)' on a null object reference
04-02 12:55:34.184 17432 17432 E AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5743)
04-02 12:55:34.184 17432 17432 E AndroidRuntime: at android.app.ActivityThread.-wrap1(Unknown Source:0)
04-02 12:55:34.184 17432 17432 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
04-02 12:55:34.184 17432 17432 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
04-02 12:55:34.184 17432 17432 E AndroidRuntime: at android.os.Looper.loop(Looper.java:164)
04-02 12:55:34.184 17432 17432 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6494)
04-02 12:55:34.184 17432 17432 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
04-02 12:55:34.184 17432 17432 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
04-02 12:55:34.184 17432 17432 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
04-02 12:55:34.184 17432 17432 E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String[] java.lang.String.split(java.lang.String)' on a null object reference
04-02 12:55:34.184 17432 17432 E AndroidRuntime: at com.topjohnwu.superuser.internal.ShellImpl.testCmd(Unknown Source:23)
04-02 12:55:34.184 17432 17432 E AndroidRuntime: at com.topjohnwu.superuser.io.SuFile.testShell(Unknown Source:16)
04-02 12:55:34.184 17432 17432 E AndroidRuntime: at com.topjohnwu.superuser.io.SuFile.<init>(Unknown Source:23)
04-02 12:55:34.184 17432 17432 E AndroidRuntime: at com.topjohnwu.magisk.database.SuDatabaseHelper.openDatabase(Unknown Source:5)
04-02 12:55:34.184 17432 17432 E AndroidRuntime: at com.topjohnwu.magisk.database.SuDatabaseHelper.<init>(Unknown Source:9)
04-02 12:55:34.184 17432 17432 E AndroidRuntime: at com.topjohnwu.magisk.database.SuDatabaseHelper.getInstance(Unknown Source:17)
04-02 12:55:34.184 17432 17432 E AndroidRuntime: at com.topjohnwu.magisk.MagiskManager.onCreate(Unknown Source:74)
04-02 12:55:34.184 17432 17432 E AndroidRuntime: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1119)
04-02 12:55:34.184 17432 17432 E AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5740)
04-02 12:55:34.184 17432 17432 E AndroidRuntime: ... 8 more
04-02 12:55:34.186 916 1613 W ActivityManager: Force finishing activity com.topjohnwu.magisk/.SplashActivity
04-02 12:55:34.194 916 948 I ActivityManager: Showing crash dialog for package com.topjohnwu.magisk u0

Thanks,

Matt