Browse Source

Merge pull request #288 from bluefoxah/master

[MOD] fix a bug.if node is nil will get an panic.
pull/291/head
Chris Lu 9 years ago
parent
commit
6c5eddaf1d
  1. 2
      go/topology/node.go

2
go/topology/node.go

@ -211,8 +211,8 @@ func (n *NodeImpl) LinkChildNode(node Node) {
func (n *NodeImpl) UnlinkChildNode(nodeId NodeId) { func (n *NodeImpl) UnlinkChildNode(nodeId NodeId) {
node := n.children[nodeId] node := n.children[nodeId]
node.SetParent(nil)
if node != nil { if node != nil {
node.SetParent(nil)
delete(n.children, node.Id()) delete(n.children, node.Id())
n.UpAdjustVolumeCountDelta(-node.GetVolumeCount()) n.UpAdjustVolumeCountDelta(-node.GetVolumeCount())
n.UpAdjustActiveVolumeCountDelta(-node.GetActiveVolumeCount()) n.UpAdjustActiveVolumeCountDelta(-node.GetActiveVolumeCount())

Loading…
Cancel
Save