From 3c8ae2370b14a6b95b3385e2983a16ecf526acc6 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Fri, 9 Jun 2023 16:09:20 +0800 Subject: [PATCH] fix array range panic --- pkg/common/db/controller/msg.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/common/db/controller/msg.go b/pkg/common/db/controller/msg.go index 1cb046125..bbf37e996 100644 --- a/pkg/common/db/controller/msg.go +++ b/pkg/common/db/controller/msg.go @@ -483,6 +483,9 @@ func (db *commonMsgDatabase) GetMsgBySeqsRange(ctx context.Context, userID strin break } } + if len(seqs) == 0 { + return 0, 0, nil, nil + } newBegin := seqs[0] newEnd := seqs[len(seqs)-1] log.ZDebug(ctx, "GetMsgBySeqsRange", "first seqs", seqs, "newBegin", newBegin, "newEnd", newEnd)