Browse Source

avoid set value to root

Xiang Li 12 years ago
parent
commit
06c9f1893f
1 changed files with 5 additions and 0 deletions
  1. 5 0
      store/tree.go

+ 5 - 0
store/tree.go

@@ -57,6 +57,11 @@ func (t *tree) set(key string, value Node) bool {
 
 	nodesName := split(key)
 
+	// avoid set value to "/"
+	if len(nodesName) == 1 && len(nodesName[0]) == 0 {
+		return false
+	}
+
 	nodeMap := t.Root.NodeMap
 
 	i := 0