From 6eec0b10a11c69f71b3949acfb19d4c4fcbe1a8a Mon Sep 17 00:00:00 2001 From: megacz Date: Fri, 30 Jan 2004 07:01:07 +0000 Subject: [PATCH] 2003/06/13 05:25:56 darcs-hash:20040130070107-2ba56-b2bc9d7bbbd119d3880f312ac4c561cf64c0e78a.gz --- src/org/xwt/js/CompiledFunction.java | 1 + src/org/xwt/js/JS.java | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/org/xwt/js/CompiledFunction.java b/src/org/xwt/js/CompiledFunction.java index 76f2bf9..23b3f95 100644 --- a/src/org/xwt/js/CompiledFunction.java +++ b/src/org/xwt/js/CompiledFunction.java @@ -234,6 +234,7 @@ public final class CompiledFunction extends JS.Callable implements ByteCodes, To } Object ret = null; if (o == null) throw je("tried to get property \"" + v + "\" from the null value"); + if (v == null) throw je("tried to get the null key from " + v); if (o instanceof String) { ret = getFromString((String)o, v); } else if (o instanceof Boolean) { diff --git a/src/org/xwt/js/JS.java b/src/org/xwt/js/JS.java index 85189b4..72c9e2a 100644 --- a/src/org/xwt/js/JS.java +++ b/src/org/xwt/js/JS.java @@ -72,7 +72,11 @@ public abstract class JS { private Scope parentScope; private static Object NULL = new Object(); public Scope(Scope parentScope) { this(parentScope, false); } - public Scope(Scope parentScope, boolean sealed) { super(sealed); this.parentScope = parentScope; } + public Scope(Scope parentScope, boolean sealed) { + super(sealed); + if (parentScope == this) throw new Error("can't make a scope its own parent!"); + this.parentScope = parentScope; + } public Scope getParentScope() { return parentScope; } // transparent scopes are not returned by THIS -- 1.7.10.4