From bee070a1b988f19300b746a81ab4056a2c6e4047 Mon Sep 17 00:00:00 2001 From: crazycs520 Date: Wed, 19 Aug 2020 11:15:44 +0800 Subject: [PATCH] fix panic on selectResultRuntimeStats.String Signed-off-by: crazycs520 --- distsql/select_result.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/distsql/select_result.go b/distsql/select_result.go index 04ac967dbbc68..ec39a8adedccf 100644 --- a/distsql/select_result.go +++ b/distsql/select_result.go @@ -393,8 +393,8 @@ func (s *selectResultRuntimeStats) String() string { } } copRPC := s.rpcStat.Stats[tikvrpc.CmdCop] - delete(s.rpcStat.Stats, tikvrpc.CmdCop) - if copRPC.Count > 0 { + if copRPC != nil && copRPC.Count > 0 { + delete(s.rpcStat.Stats, tikvrpc.CmdCop) buf.WriteString(", rpc_num: ") buf.WriteString(strconv.FormatInt(copRPC.Count, 10)) buf.WriteString(", rpc_time: ")