Skip to content

Commit

Permalink
🐛 修复网络请求头拦截获取macos的版本号出现的异常问题
Browse files Browse the repository at this point in the history
  • Loading branch information
stars-one committed May 9, 2023
1 parent 553a154 commit 2892cce
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import okhttp3.Interceptor
import okhttp3.Response
import tornadofx.*
import java.net.URLEncoder
import kotlin.math.roundToInt


/**
Expand Down Expand Up @@ -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 {
//加载图标字体文件
Expand Down

0 comments on commit 2892cce

Please sign in to comment.