commit fafb88d9ce9fa111584565a317b3b19691488bc1
parent d4c8a21504ec1e4f724557b0213b8b8d949e22e6
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date:   Thu, 28 Aug 2025 15:22:34 +0200

fix(core): syncRemote crash

Signed-off-by: rhunk <101876869+rhunk@users.noreply.github.com>

Diffstat:
Mcore/src/main/kotlin/me/rhunk/snapenhance/core/SnapEnhance.kt | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/SnapEnhance.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/SnapEnhance.kt @@ -337,10 +337,12 @@ class SnapEnhance { } private fun syncRemote() { + if (!appContext.isLoggedIn()) return + val myUserId = appContext.database.myUserId - val streakEntries = appContext.database.getFeedEntries(Int.MAX_VALUE, whereClause = "streak_count IS NOT NULL AND streak_count > 0").associate { - (it.friendUserId ?: it.participants?.firstOrNull { it != myUserId }) to it - }.filter { it.key != null } + val streakEntries = appContext.database.getFeedEntries(Int.MAX_VALUE, whereClause = "streak_count IS NOT NULL AND streak_count > 0") + .associateBy { entry -> (entry.friendUserId ?: entry.participants?.firstOrNull { it != myUserId }) } + .filter { it.key != null } appContext.bridgeClient.sync(object : SyncCallback.Stub() { override fun syncFriend(uuid: String): String? {