浏览代码

Fix: TMap.Copy() now only copies _root if there were entries in the map

Ronny Otto 8 年之前
父节点
当前提交
ba7901ff4a
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      map.mod/map.bmx

+ 4 - 1
map.mod/map.bmx

@@ -293,7 +293,10 @@ Type TMap
 	
 	Method Copy:TMap()
 		Local map:TMap=New TMap
-		map._root=_root.Copy( nil )
+		'avoid copying an empty map (_root = nil there), else it borks "eachin"
+		if _root <> nil
+			map._root=_root.Copy( nil )
+		endif
 		Return map
 	End Method