Sfoglia il codice sorgente

avoid set value to root

Xiang Li 13 anni fa
parent
commit
06c9f1893f
1 ha cambiato i file con 5 aggiunte e 0 eliminazioni
  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