fix: [Cherry-pick] Check collection nil before check load status (#31850) (#31897)

Cherry-pick from master
pr: #31850
See also #31849

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
pull/31413/head
congqixia 2024-04-08 10:01:16 +08:00 committed by GitHub
parent 429f0c525e
commit 958f933810
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -899,7 +899,7 @@ func (s *Server) GetShardLeaders(ctx context.Context, req *querypb.GetShardLeade
return resp, nil
}
collection := s.meta.CollectionManager.GetCollection(req.GetCollectionID())
if collection.GetStatus() == querypb.LoadStatus_Loaded {
if collection != nil && collection.GetStatus() == querypb.LoadStatus_Loaded {
// when collection is loaded, regard collection as readable, set percentage == 100
percentage = 100
}