From a7a97dc5fbec7b75494e14bc15a49ff46ebb5b5a Mon Sep 17 00:00:00 2001 From: JingMatrix Date: Fri, 17 Apr 2026 12:12:37 +0200 Subject: [PATCH] Ensure `miscPath` is initialized for system_server modules 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. --- .../main/kotlin/org/matrix/vector/daemon/data/ConfigCache.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/daemon/src/main/kotlin/org/matrix/vector/daemon/data/ConfigCache.kt b/daemon/src/main/kotlin/org/matrix/vector/daemon/data/ConfigCache.kt index 0fb6e707d..a4d8963c7 100644 --- a/daemon/src/main/kotlin/org/matrix/vector/daemon/data/ConfigCache.kt +++ b/daemon/src/main/kotlin/org/matrix/vector/daemon/data/ConfigCache.kt @@ -83,6 +83,8 @@ object ConfigCache { } private fun setupMiscPath() { + if (state.miscPath != null) return + val pathStr = PreferenceStore.getModulePrefs("lspd", 0, "config")["misc_path"] as? String val path = if (pathStr == null) { @@ -423,7 +425,7 @@ object ConfigCache { } fun getPrefsPath(packageName: String, uid: Int): String { - ensureCacheReady() + setupMiscPath() val basePath = state.miscPath ?: throw IllegalStateException("Fatal: miscPath not initialized!") val userId = uid / PER_USER_RANGE