trojan-gfw / igniter

A trojan client for Android (UNDER CONSTRUCTION).
GNU General Public License v3.0
3.3k stars 736 forks source link

Crash on Google Pixel 3 XL (crosshatch), 3584MB RAM, Android API 30 #276

Closed wongsyrone closed 4 years ago

wongsyrone commented 4 years ago

Google Pixel 3 XL (crosshatch), 3584MB RAM, Android API 30

java.lang.NullPointerException: 
  at io.github.trojan_gfw.igniter.common.utils.PreferenceUtils.getBooleanPreference (PreferenceUtils.java:15)
  at io.github.trojan_gfw.igniter.tile.IgniterTileService.isFirstStart (IgniterTileService.java:117)
  at io.github.trojan_gfw.igniter.tile.IgniterTileService.onClick (IgniterTileService.java:125)
  at android.service.quicksettings.TileService$H.handleMessage (TileService.java:449)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:223)
  at android.app.ActivityThread.main (ActivityThread.java:7656)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:592)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:947)
TchaikovDriver commented 4 years ago

ContentResolverCompat.query() returned an null cursor and thus caused the NullPointerException. There are 4 main causes for this exception:

In this circumstance, PreferencesProvider is registed in AndroidManifest.xml and the uri is ensured to be valid. Also, PreferencesProvider does not return null in method query(). So the bug is likely to be caused by the RemoteException. Do a null-check will help.