Describe the bug
在一些特定情况下 com.osfans.trime.ime.core.Trime.loadBackground 会访问未初始化的变量,造成 trime 崩溃
To Reproduce
Steps to reproduce the bug:
在 onCreateInputView 被调用之前调用 loadBackground,通过如下方法
使 Trime 处于未初始化状态,有几种方式:
在 Android 任务视图里划掉 Trime(这个具体的行为依赖 ROM 的实现,可能无法稳定复现)
覆盖安装 trime
trime 崩溃后
系统重启后
需要注意的是,使用 App Info 里的强制结束无法达到等同效果
在这之后不要点击任何输入栏
打开 Trime,进入 Appearance,点击 Themes 或者 Colors
随便选一个,或者不选,点 OK
崩溃
Expected behavior
A clear and concise description of what you expected to happen.
Log
java.lang.NullPointerException: Attempt to invoke virtual method 'void com.osfans.trime.ime.keyboard.KeyboardView.setPadding(int, int, int, int)' on a null object reference
at com.osfans.trime.ime.core.Trime.loadBackground(Trime.java:490)
at com.osfans.trime.ime.core.Trime.initKeyboard(Trime.java:560)
at com.osfans.trime.settings.components.ColorPickerDialog.selectColor(ColorPickerDialog.kt:46)
at com.osfans.trime.settings.components.ColorPickerDialog.lambda-2$lambda-0(ColorPickerDialog.kt:34)
at com.osfans.trime.settings.components.ColorPickerDialog.$r8$lambda$8oSxrFMJJx1x-pXTOGn1ZF_kUvU(Unknown Source:0)
at com.osfans.trime.settings.components.ColorPickerDialog$$ExternalSyntheticLambda0.onClick(Unknown Source:2)
at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:174)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7664)
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)
Screenshots
If applicable, add screenshots to help explain your problem.
Smartphone (please complete the following information):
OS: Android 11
Version: cd19c26c710acde288395e89205d3a32b43e12e3
Additional context
Add any other context about the problem here.
Describe the bug 在一些特定情况下
com.osfans.trime.ime.core.Trime.loadBackground
会访问未初始化的变量,造成 trime 崩溃To Reproduce Steps to reproduce the bug:
在
onCreateInputView
被调用之前调用loadBackground
,通过如下方法Expected behavior A clear and concise description of what you expected to happen.
Log
Screenshots If applicable, add screenshots to help explain your problem.
Smartphone (please complete the following information):
Additional context Add any other context about the problem here.