8000 Fix crash when opening table addon config while it's not loaded · JUST-INTJ/fcitx5-android@96506d1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 96506d1

Browse files
committed
Fix crash when opening table addon config while it's not loaded
1 parent b381b41 commit 96506d1

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

app/src/main/java/org/fcitx/fcitx5/android/ui/main/settings/addon/AddonConfigFragment.kt

+8-7
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@ class AddonConfigFragment : FcitxPreferenceFragment() {
1616
val addon = requireStringArg(ARG_UNIQUE_NAME)
1717
val raw = fcitx.getAddonConfig(addon)
1818
if (addon == "table") {
19-
val desc = raw["desc"]["TableGlobalConfig"]
20-
val androidTable = RawConfig(
21-
"AndroidTable", subItems = arrayOf(
22-
RawConfig("Type", "External"),
23-
RawConfig("Description", getString(R.string.manage_table_im))
19+
// append android specific "Manage Table Input Methods" to config of table addon
20+
raw.findByName("desc")?.findByName("TableGlobalConfig")?.let {
21+
it.subItems = (it.subItems ?: emptyArray()) + RawConfig(
22+
"AndroidTable", subItems = arrayOf(
23+
RawConfig("Type", "External"),
24+
RawConfig("Description", getString(R.string.manage_table_im))
25+
)
2426
)
25-
)
26-
desc.subItems = (desc.subItems ?: arrayOf()) + androidTable
27+
}
2728
}
2829
return raw
2930
}

0 commit comments

Comments
 (0)
0