Permalink
Browse files

catch getDefinition errors

  • Loading branch information...
1 parent 0983ab2 commit b5c27af686740cd6937242820bed21fe12274d8a @mherkender committed Feb 6, 2012
Showing with 13 additions and 2 deletions.
  1. +6 −1 as3/com/brokenfunction/json/decodeJson.as
  2. +7 −1 as3/com/brokenfunction/json/encodeJson.as
@@ -42,7 +42,12 @@ function initDecodeJson():Function {
var byteInput:ByteArray;
var char:uint;
- const nativeJson:Object = ApplicationDomain.currentDomain.getDefinition("JSON");
+ var nativeJson:Object;
+ try {
+ nativeJson = ApplicationDomain.currentDomain.getDefinition("JSON");
+ } catch (e:ReferenceError) {
+ // ignore
+ }
const charConvert:ByteArray = new ByteArray();
charConvert.length = 0x100;// fill w/ 0's
@@ -54,7 +54,13 @@ function initDecodeJson():Function {
var tempBytes:ByteArray = new ByteArray();
var blockNonFiniteNumbers:Boolean;
- const nativeJson:Object = ApplicationDomain.currentDomain.getDefinition("JSON");
+ var nativeJson:Object;
+ try {
+ nativeJson = ApplicationDomain.currentDomain.getDefinition("JSON");
+ } catch (e:ReferenceError) {
+ // ignore
+ }
+
const charConvert:Array = new Array(0x100);
for (j = 0; j < 0xa; j++) {

0 comments on commit b5c27af

Please sign in to comment.