fix refresh open token may occurs nil pointer exception

This commit is contained in:
tickstep 2024-03-11 15:21:40 +08:00
parent 425dddf92b
commit 0064a23f64

View File

@ -222,7 +222,7 @@ func RefreshOpenTokenInNeed(activeUser *config.PanUser) bool {
// refresh expired openapi token
if activeUser.PanClient().OpenapiPanClient() != nil {
if len(activeUser.OpenapiToken.AccessToken) > 0 {
if activeUser.OpenapiToken != nil && len(activeUser.OpenapiToken.AccessToken) > 0 {
cz := time.FixedZone("CST", 8*3600) // 东8区
expiredTime := time.Unix(activeUser.OpenapiToken.Expired, 0).In(cz)
now := time.Now()