Skip to content

Commit

Permalink
fix null check
Browse files Browse the repository at this point in the history
Signed-off-by: 'Tanjin Xu' <tanjin.xu@slack-corp.com>
  • Loading branch information
tanjinx committed May 1, 2024
1 parent 4b3cf88 commit 3f95808
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions go/vt/topo/topoproto/srvkeyspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ func (sra ShardReferenceArray) Sort() { sort.Sort(sra) }
// SrvKeyspaceGetPartition returns a Partition for the given tablet type,
// or nil if it's not there.
func SrvKeyspaceGetPartition(sk *topodatapb.SrvKeyspace, tabletType topodatapb.TabletType) *topodatapb.SrvKeyspace_KeyspacePartition {
if sk == nil {
return nil
}

for _, p := range sk.Partitions {
if p.ServedType == tabletType {
return p
Expand Down

0 comments on commit 3f95808

Please sign in to comment.