fix nil pointer dereference in scheduler.go (#388)

This commit is contained in:
guapi 2022-04-15 19:57:29 +08:00 committed by GitHub
parent c083988b20
commit 98a65f4d63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -224,6 +224,11 @@ func (m *MockSchedulerClient) AskSplit(ctx context.Context, region *metapb.Regio
if err != nil {
return resp, err
}
if curRegion == nil || curRegion.GetId() != region.GetId() {
return resp, errors.New("region not found")
}
if util.IsEpochStale(region.RegionEpoch, curRegion.RegionEpoch) {
return resp, errors.New("epoch is stale")
}