mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-04 19:17:37 +08:00
fix: log error when reading version file. (#2503)
This commit is contained in:
parent
9cccd0e39b
commit
d25e320238
@ -255,8 +255,14 @@ func LoginInteract() {
|
||||
versionFile := path.Join(global.VersionsPath, fmt.Sprint(int(cli.Device().Protocol))+".json")
|
||||
if global.PathExists(versionFile) {
|
||||
b, err := os.ReadFile(versionFile)
|
||||
if err == nil {
|
||||
_ = cli.Device().Protocol.Version().UpdateFromJson(b)
|
||||
if err != nil {
|
||||
log.Warnf("从文件 %s 读取本地版本信息文件出错.", versionFile)
|
||||
os.Exit(0)
|
||||
}
|
||||
err = cli.Device().Protocol.Version().UpdateFromJson(b)
|
||||
if err != nil {
|
||||
log.Warnf("从文件 %s 解析本地版本信息出错: %v", versionFile, err)
|
||||
os.Exit(0)
|
||||
}
|
||||
log.Infof("从文件 %s 读取协议版本 %v.", versionFile, cli.Device().Protocol.Version())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user