From 2892ccea505b83ea0c6ae78b6430b6b08afe405c Mon Sep 17 00:00:00 2001 From: starone Date: Tue, 9 May 2023 20:44:15 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8D=E7=BD=91=E7=BB=9C?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E5=A4=B4=E6=8B=A6=E6=88=AA=E8=8E=B7=E5=8F=96?= =?UTF-8?q?macos=E7=9A=84=E7=89=88=E6=9C=AC=E5=8F=B7=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E7=9A=84=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controls/utils/net/CommonHeaderInterceptor.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/starsone/controls/utils/net/CommonHeaderInterceptor.kt b/src/main/kotlin/com/starsone/controls/utils/net/CommonHeaderInterceptor.kt index 5c68574..381d717 100644 --- a/src/main/kotlin/com/starsone/controls/utils/net/CommonHeaderInterceptor.kt +++ b/src/main/kotlin/com/starsone/controls/utils/net/CommonHeaderInterceptor.kt @@ -5,6 +5,7 @@ import okhttp3.Interceptor import okhttp3.Response import tornadofx.* import java.net.URLEncoder +import kotlin.math.roundToInt /** @@ -52,7 +53,12 @@ class CommonHeaderInterceptor() : Interceptor { val props = System.getProperties() val osName = props.getProperty("os.name") val arch = props.getProperty("os.arch") - val osVersionCode = props.getProperty("os.version").toDouble().toInt() + val osVersionCode = try { + props.getProperty("os.version").toDouble().roundToInt() + } catch (e: Exception) { + 1 + } + val resources = ResourceLookup(this) return try { //加载图标字体文件