fix load profile return nil invalid selected
This commit is contained in:
3 files changed
+5
-6
No files matched your search
@@ -33,6 +33,8 @@ func handleProfileReload(client *net.UnixConn) {
|
||||
InvalidSelected []string `json:"invalidSelected"`
|
||||
}
|
||||
|
||||
response.InvalidSelected = make([]string, 0)
|
||||
|
||||
defer func() {
|
||||
buf, _ := json.Marshal(&response)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user