Browse Source

Merge pull request #42 from GWRon/fix_map_copy

Fix: TMap.Copy() now only copies _root if there were entries in the map
Brucey 8 years ago
parent
commit
3b452c767b
1 changed files with 4 additions and 1 deletions
  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