Browse Source

Merge branch 'fileSystem' of https://github.com/xiangli-cmu/etcd into fileSystem

Xiang Li 12 years ago
parent
commit
e71dad9d32
1 changed files with 2 additions and 2 deletions
  1. 2 2
      file_system/node.go

+ 2 - 2
file_system/node.go

@@ -76,7 +76,7 @@ func (n *Node) Remove(recursive bool, callback func(path string)) error {
 	if !n.IsDir() { // file node: key-value pair
 		_, name := path.Split(n.Path)
 
-		if n.Parent.Children[name] == n {
+		if n.Parent != nil && n.Parent.Children[name] == n {
 			// This is the only pointer to Node object
 			// Handled by garbage collector
 			delete(n.Parent.Children, name)
@@ -102,7 +102,7 @@ func (n *Node) Remove(recursive bool, callback func(path string)) error {
 
 	// delete self
 	_, name := path.Split(n.Path)
-	if n.Parent.Children[name] == n {
+	if n.Parent != nil && n.Parent.Children[name] == n {
 		delete(n.Parent.Children, name)
 
 		if callback != nil {