From b6174f659fb9f907dee3a900c05f02f91576f909 Mon Sep 17 00:00:00 2001 From: Nathan Curtis Date: Mon, 9 Aug 2010 18:30:45 +0000 Subject: [PATCH] If no map class is passed in (should only happen on deserialization, and the real source map is provided on readObject), pass an empty immutable map to super, which is less weird and probably better than just ignoring and forcibly not calling the super constructor, which is what was happening. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6105 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/as/com/threerings/util/StreamableHashMap.as | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/as/com/threerings/util/StreamableHashMap.as b/src/as/com/threerings/util/StreamableHashMap.as index 1b3edfdd4..b65721db4 100644 --- a/src/as/com/threerings/util/StreamableHashMap.as +++ b/src/as/com/threerings/util/StreamableHashMap.as @@ -27,6 +27,8 @@ import com.threerings.io.Streamable; import com.threerings.util.Maps; import com.threerings.util.maps.ForwardingMap; +import com.threerings.util.maps.HashMap; +import com.threerings.util.maps.ImmutableMap; /** * A Map that can be sent over the wire, bearing in mind that all keys and values must @@ -40,9 +42,7 @@ public class StreamableHashMap extends ForwardingMap { public function StreamableHashMap (keyClazz :Class = null) { - if (keyClazz != null) { - super(Maps.newMapOf(keyClazz)); - } + super(keyClazz == null ? DEFAULT_MAP : Maps.newMapOf(keyClazz)); } // documentation inherited from interface Streamable @@ -73,5 +73,7 @@ public class StreamableHashMap extends ForwardingMap _source = Maps.newMapOf(String); // hope for the best } } + + protected static const DEFAULT_MAP :Map = new ImmutableMap(new HashMap()); } }