Skip to content

Commit 846527e

Browse files
kiber-ioJingMatrix
andauthored
Ensure miscPath is initialized for system_server modules (#678)
The `ensureCacheReady` method waits for the 'package' service, which is often unavailable when modules inject into `system_server`. This leads to an uninitialized `miscPath` when `getPrefsPath` is called early. We thus call `setupMiscPath` directly in `getPrefsPath` to bypass the package service dependency, and add a null check to avoid redundant initialization. Co-authored-by: JingMatrix <jingmatrix@gmail.com>
1 parent ec3e6f2 commit 846527e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

daemon/src/main/kotlin/org/matrix/vector/daemon/data/ConfigCache.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ object ConfigCache {
8383
}
8484

8585
private fun setupMiscPath() {
86+
if (state.miscPath != null) return
87+
8688
val pathStr = PreferenceStore.getModulePrefs("lspd", 0, "config")["misc_path"] as? String
8789
val path =
8890
if (pathStr == null) {
@@ -423,7 +425,7 @@ object ConfigCache {
423425
}
424426

425427
fun getPrefsPath(packageName: String, uid: Int): String {
426-
ensureCacheReady()
428+
setupMiscPath()
427429
val basePath = state.miscPath ?: throw IllegalStateException("Fatal: miscPath not initialized!")
428430

429431
val userId = uid / PER_USER_RANGE

0 commit comments

Comments
 (0)