mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-04-05 20:52:50 +08:00
avoid possible nil when node is disconnected from its parent
fix https://github.com/chrislusf/seaweedfs/issues/2073
This commit is contained in:
parent
6c1c72b1f4
commit
87a32bfef4
@ -177,7 +177,13 @@ func (dn *DataNode) GetVolumesById(id needle.VolumeId) (vInfo storage.VolumeInfo
|
|||||||
|
|
||||||
func (dn *DataNode) GetDataCenter() *DataCenter {
|
func (dn *DataNode) GetDataCenter() *DataCenter {
|
||||||
rack := dn.Parent()
|
rack := dn.Parent()
|
||||||
|
if rack == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
dcNode := rack.Parent()
|
dcNode := rack.Parent()
|
||||||
|
if dcNode == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
dcValue := dcNode.GetValue()
|
dcValue := dcNode.GetValue()
|
||||||
return dcValue.(*DataCenter)
|
return dcValue.(*DataCenter)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user