Skip to content

Commit

Permalink
fix: log error when reading version file. (#2503)
Browse files Browse the repository at this point in the history
  • Loading branch information
Akegarasu authored Jan 4, 2024
1 parent 9cccd0e commit d25e320
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmd/gocq/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down

0 comments on commit d25e320

Please sign in to comment.