fix(peering): nil pointer in calling handleUpdateService (#15160)
* fix(peering): nil pointer in calling handleUpdateService * changelog
This commit is contained in:
parent
9d36db3a2a
commit
57380ea752
|
@ -0,0 +1,3 @@
|
|||
```release-note:bug
|
||||
peering: fix nil pointer in calling handleUpdateService
|
||||
```
|
|
@ -287,7 +287,6 @@ func (s *Server) handleUpsertExportedServiceList(
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, sn := range serviceList {
|
||||
if _, ok := exportedServices[sn]; !ok {
|
||||
err := s.handleUpdateService(peerName, partition, sn, nil)
|
||||
|
@ -324,10 +323,13 @@ func (s *Server) handleUpdateService(
|
|||
return fmt.Errorf("failed to read imported services: %w", err)
|
||||
}
|
||||
|
||||
structsNodes, err := export.CheckServiceNodesToStruct()
|
||||
structsNodes := []structs.CheckServiceNode{}
|
||||
if export != nil {
|
||||
structsNodes, err = export.CheckServiceNodesToStruct()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to convert protobuf instances to structs: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Normalize the data into a convenient form for operation.
|
||||
snap := newHealthSnapshot(structsNodes, partition, peerName)
|
||||
|
|
Loading…
Reference in New Issue