[MOD] fix a bug.if node is nil will get an panic.

This commit is contained in:
张远浩 2016-04-11 18:17:22 +08:00
parent c67aee7012
commit 7a7f4cecbb

View file

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