1
0
Fork 0
mirror of https://github.com/chrislusf/seaweedfs synced 2024-06-29 05:41:02 +02:00

avoid possible nil when node is disconnected from its parent

fix https://github.com/chrislusf/seaweedfs/issues/2073
This commit is contained in:
Chris Lu 2021-05-19 10:02:01 -07:00
parent 6c1c72b1f4
commit 87a32bfef4

View file

@ -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)
}