diff --git a/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/ui/theme/Theme.desktop.kt b/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/ui/theme/Theme.desktop.kt index d7da2fa123..94268002a6 100644 --- a/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/ui/theme/Theme.desktop.kt +++ b/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/ui/theme/Theme.desktop.kt @@ -1,5 +1,7 @@ package chat.simplex.common.ui.theme +import chat.simplex.common.platform.Log +import chat.simplex.common.platform.TAG import com.jthemedetecor.OsThemeDetector private val detector: OsThemeDetector = OsThemeDetector.getDetector() @@ -7,4 +9,11 @@ private val detector: OsThemeDetector = OsThemeDetector.getDetector() registerListener(::reactOnDarkThemeChanges) } -actual fun isSystemInDarkTheme(): Boolean = detector.isDark +actual fun isSystemInDarkTheme(): Boolean = try { + detector.isDark +} +catch (e: Exception) { + Log.e(TAG, e.stackTraceToString()) + /* On Mac this code can produce exception */ + false +}