Browse Source

avoid possible nil when node is disconnected from its parent

fix https://github.com/chrislusf/seaweedfs/issues/2073
pull/2074/head
Chris Lu 4 years ago
parent
commit
87a32bfef4
  1. 6
      weed/topology/data_node.go

6
weed/topology/data_node.go

@ -177,7 +177,13 @@ func (dn *DataNode) GetVolumesById(id needle.VolumeId) (vInfo storage.VolumeInfo
func (dn *DataNode) GetDataCenter() *DataCenter {
rack := dn.Parent()
if rack == nil {
return nil
}
dcNode := rack.Parent()
if dcNode == nil {
return nil
}
dcValue := dcNode.GetValue()
return dcValue.(*DataCenter)
}

Loading…
Cancel
Save