r9628 - helma/helma/trunk/src/helma/scripting/rhino
[email protected] Mon, 20 Apr 2009 13:07:55 +0200 (CEST)
| Newsgroups | gmane.comp.java.helma.cvs |
|---|---|
| Message-ID | <20090420110755.BFE963D0D6@mia> |
Author: hannes
Date: 2009-04-20 13:07:55 +0200 (Mon, 20 Apr 2009)
New Revision: 9628
Modified:
helma/helma/trunk/src/helma/scripting/rhino/HopObject.java
Log:
Try to fix NullPointerException in NodeProxy.getNode().
Details at http://dev.helma.org/trac/helma/changeset/9628
Modified: helma/helma/trunk/src/helma/scripting/rhino/HopObject.java
===================================================================
--- helma/helma/trunk/src/helma/scripting/rhino/HopObject.java 2009-04-17 20:41:00 UTC (rev 9627)
+++ helma/helma/trunk/src/helma/scripting/rhino/HopObject.java 2009-04-20 11:07:55 UTC (rev 9628)
@@ -1148,20 +1148,23 @@
if (node == null || node.getState() == Node.INVALID) {
if (handle != null) {
node = handle.getNode(core.app.getWrappedNodeManager());
- String protoname = node.getPrototype();
- // the actual prototype name may vary from the node handle's prototype name
- if (className == null || !className.equals(protoname)) {
- Scriptable proto = core.getValidPrototype(protoname);
- if (proto == null) {
- protoname = "HopObject";
- proto = core.getValidPrototype("HopObject");
+ if (node != null) {
+ String protoname = node.getPrototype();
+ // the actual prototype name may vary from the node handle's prototype name
+ if (className == null || !className.equals(protoname)) {
+ Scriptable proto = core.getValidPrototype(protoname);
+ if (proto == null) {
+ protoname = "HopObject";
+ proto = core.getValidPrototype("HopObject");
+ }
+ className = protoname;
+ setPrototype(proto);
}
- className = protoname;
- setPrototype(proto);
}
- } else {
- // we probably have a deleted node. Replace with empty transient node
- // to avoid throwing an exception.
+ }
+ if (node == null || node.getState() == Node.INVALID) {
+ // We probably have a deleted node.
+ // Replace with empty transient node to avoid throwing an exception.
node = new Node("DeletedNode", null, core.app.getWrappedNodeManager());
}
}