Try to fix NullPointerException in NodeProxy.getNode().

This commit is contained in:
hns 2009-04-20 11:07:55 +00:00
parent 4875a85fce
commit b0478b020b

View file

@ -1148,6 +1148,7 @@ public class HopObject extends ScriptableObject implements Wrapper, PropertyReco
if (node == null || node.getState() == Node.INVALID) {
if (handle != null) {
node = handle.getNode(core.app.getWrappedNodeManager());
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)) {
@ -1159,9 +1160,11 @@ public class HopObject extends ScriptableObject implements Wrapper, PropertyReco
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());
}
}