From ac242c0ecadf9d0a12c504b6872355700d221a89 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Tue, 15 Aug 2006 21:32:50 +0000 Subject: [PATCH] Encode nulls as a null byte array. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4325 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/as/com/threerings/util/FlashObjectMarshaller.as | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/as/com/threerings/util/FlashObjectMarshaller.as b/src/as/com/threerings/util/FlashObjectMarshaller.as index 0626caf81..984190251 100644 --- a/src/as/com/threerings/util/FlashObjectMarshaller.as +++ b/src/as/com/threerings/util/FlashObjectMarshaller.as @@ -13,6 +13,12 @@ public class FlashObjectMarshaller { public static function encode (obj :Object) :ByteArray { + if (obj == null) { + return null; + } + + // TODO: Our own encoding, that takes into account + // the ApplicationDomain var bytes :ByteArray = new ByteArray(); bytes.endian = Endian.BIG_ENDIAN; bytes.objectEncoding = ObjectEncoding.AMF3; @@ -22,6 +28,12 @@ public class FlashObjectMarshaller public static function decode (bytes :ByteArray) :Object { + if (bytes == null) { + return null; + } + + // TODO: Our own encoding, that takes into account + // the ApplicationDomain bytes.endian = Endian.BIG_ENDIAN; bytes.objectEncoding = ObjectEncoding.AMF3; return bytes.readObject();