diff --git a/core/src/main/golang/server/profile.go b/core/src/main/golang/server/profile.go index 0c45dc0..172ab13 100644 --- a/core/src/main/golang/server/profile.go +++ b/core/src/main/golang/server/profile.go @@ -33,6 +33,8 @@ func handleProfileReload(client *net.UnixConn) { InvalidSelected []string `json:"invalidSelected"` } + response.InvalidSelected = make([]string, 0) + defer func() { buf, _ := json.Marshal(&response) diff --git a/core/src/main/java/com/github/kr328/clash/core/Clash.kt b/core/src/main/java/com/github/kr328/clash/core/Clash.kt index e0dfbf2..abfe09b 100644 --- a/core/src/main/java/com/github/kr328/clash/core/Clash.kt +++ b/core/src/main/java/com/github/kr328/clash/core/Clash.kt @@ -2,8 +2,6 @@ package com.github.kr328.clash.core import android.content.Context import android.net.LocalSocket -import android.util.Log -import com.github.kr328.clash.core.Constants.TAG import com.github.kr328.clash.core.event.BandwidthEvent import com.github.kr328.clash.core.event.LogEvent import com.github.kr328.clash.core.event.ProcessEvent @@ -11,9 +9,9 @@ import com.github.kr328.clash.core.event.SpeedEvent import com.github.kr328.clash.core.model.LoadProfilePacket import com.github.kr328.clash.core.model.RawProxyPacket import com.github.kr328.clash.core.model.SetProxyPacket +import com.github.kr328.clash.core.utils.Log import kotlinx.serialization.json.Json import kotlinx.serialization.json.JsonConfiguration -import org.json.JSONObject import java.io.File import java.io.FileDescriptor import java.io.IOException @@ -53,8 +51,7 @@ class Clash( LoadProfilePacket.Request(file.absolutePath, selected))) val result = Json(JsonConfiguration.Stable) - .parse(LoadProfilePacket.Response.serializer(), - input.readString()) + .parse(LoadProfilePacket.Response.serializer(), input.readString()) if (result.error.isNotEmpty()) { throw IOException(result.error) diff --git a/service/src/main/java/com/github/kr328/clash/service/ClashService.kt b/service/src/main/java/com/github/kr328/clash/service/ClashService.kt index c789962..be7c61d 100644 --- a/service/src/main/java/com/github/kr328/clash/service/ClashService.kt +++ b/service/src/main/java/com/github/kr328/clash/service/ClashService.kt @@ -244,7 +244,7 @@ class ClashService : Service(), IClashEventObserver, ClashEventService.Master, profileService.removeCurrentProfileProxy(remove) notification.setProfile(active.name) - } catch (e: IOException) { + } catch (e: Exception) { clash.process.stop() Log.w("Load profile failure", e) }