From 5926b5af29c0d7e8d7216048ce8483fe05591203 Mon Sep 17 00:00:00 2001 From: zl Date: Wed, 26 Jan 2022 14:40:33 +0800 Subject: [PATCH] fix: use nil pointer without check nil --- app/venus-sealer/sectors.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/app/venus-sealer/sectors.go b/app/venus-sealer/sectors.go index b7f4f470..e2882c8b 100644 --- a/app/venus-sealer/sectors.go +++ b/app/venus-sealer/sectors.go @@ -249,12 +249,21 @@ var sectorsStatusCmd = &cli.Command{ fmt.Printf("Last Error:\t\t%s\n", status.LastErr) } - fmt.Printf("CCUpdate:\t\t\n", status.CCUpdate) + fmt.Printf("CCUpdate:\t%v\n", status.CCUpdate) if status.CCUpdate { - fmt.Printf("UpdateSealed:\t\t\n", status.UpdateSealed.String()) - fmt.Printf("UpdateIUnsealed:\t\t\n", status.UpdateUnsealed.String()) - fmt.Printf("ReplicaUpdateMessage:\t\t\n", status.ReplicaUpdateMessage) + var updateSealed, updateUnsealed string + + if status.UpdateSealed != nil { + updateSealed = status.UpdateSealed.String() + } + if status.UpdateUnsealed != nil { + updateUnsealed = status.UpdateUnsealed.String() + } + + fmt.Printf("UpdateSealed:\t%s\n", updateSealed) + fmt.Printf("UpdateUnsealed:\t%s\n", updateUnsealed) + fmt.Printf("ReplicaUpdateMessage:%s\n", status.ReplicaUpdateMessage) } if onChainInfo {