Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix nil pointer dereference caused by nil 'cs' #2440

Merged
merged 4 commits into from
Oct 1, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: nil pointer dereference caused by nil 'cs'
修复刷新 token 时若当前签名服务不可用而主签名服务可用会导致panic的问题。
btw, energy 出现decode error时打印出导致错误的数据内容
  • Loading branch information
1umine committed Sep 19, 2023
commit a77a3d1334bf35163ff4ba703c3df4e20ad2709c
4 changes: 2 additions & 2 deletions cmd/gocq/qsign.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func energy(uin uint64, id string, _ string, salt []byte) ([]byte, error) {
}
data, err := hex.DecodeString(gjson.GetBytes(response, "data").String())
if err != nil {
log.Warnf("获取T544 sign时出现错误: %v", err)
log.Warnf("获取T544 sign时出现错误: %v (data: %v)", err, gjson.GetBytes(response, "data").String())
return nil, err
}
if len(data) == 0 {
Expand Down Expand Up @@ -397,7 +397,7 @@ func signStartRefreshToken(interval int64) {
cs, master := ss.get(), &base.SignServers[0]
if (cs == nil || cs.URL != master.URL) && isServerAvaliable(master.URL) {
ss.set(master)
log.Infof("主签名服务器可用,已切换至主签名服务器 %v", cs.URL)
log.Infof("主签名服务器可用,已切换至主签名服务器 %v", master.URL)
}
cs = ss.get()
if cs == nil {
Expand Down