mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 02:37:24 +08:00
fix: avoid parse json err nil pointer
This commit is contained in:
@@ -660,12 +660,14 @@ func ParseJSONResponse(resp *http.Response, err error, debug bool) (http.Header,
|
||||
jrbody2 = v
|
||||
}
|
||||
}
|
||||
if ecode, _ := jrbody2.GetString("code"); len(ecode) > 0 {
|
||||
code, err := strconv.Atoi(ecode)
|
||||
if err != nil {
|
||||
ce.Class = ecode
|
||||
} else {
|
||||
ce.Code = code
|
||||
if jrbody2 != nil {
|
||||
if ecode, _ := jrbody2.GetString("code"); len(ecode) > 0 {
|
||||
code, err := strconv.Atoi(ecode)
|
||||
if err != nil {
|
||||
ce.Class = ecode
|
||||
} else {
|
||||
ce.Code = code
|
||||
}
|
||||
}
|
||||
}
|
||||
if ce.Code == 0 {
|
||||
|
||||
Reference in New Issue
Block a user