Skip to content

Commit 3bcb437

Browse files
committed
Avoid NPE from NativeFunctionRootNode.getName() during CallTarget creation.
1 parent 9145ce7 commit 3bcb437

File tree

1 file changed

+1
-1
lines changed
  • graal-nodejs/mx.graal-nodejs/com.oracle.truffle.trufflenode/src/com/oracle/truffle/trufflenode

1 file changed

+1
-1
lines changed

graal-nodejs/mx.graal-nodejs/com.oracle.truffle.trufflenode/src/com/oracle/truffle/trufflenode/GraalJSAccess.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1752,6 +1752,7 @@ private DynamicObject functionTemplateCreateCallback(JSContext context, JSRealm
17521752
if (functionData == null) {
17531753
JSOrdinary instanceLayout = template.getInstanceTemplate().getInternalFieldCount() > 0 ? JSOrdinary.INTERNAL_FIELD_INSTANCE : JSOrdinary.INSTANCE;
17541754
functionData = JSFunctionData.create(context, template.getLength(), template.getClassName(), template.getPrototypeTemplate() != null, false, false, false);
1755+
template.setFunctionData(functionData);
17551756
CallTarget callTarget = Truffle.getRuntime().createCallTarget(new ExecuteNativeFunctionNode.NativeFunctionRootNode(this, context, template, false, false));
17561757
CallTarget newCallTarget = Truffle.getRuntime().createCallTarget(new ExecuteNativeFunctionNode.NativeFunctionRootNode(this, context, template, true, false));
17571758
CallTarget newTargetCallTarget = Truffle.getRuntime().createCallTarget(new ExecuteNativeFunctionNode.NativeFunctionRootNode(this, context, template, true, true));
@@ -1760,7 +1761,6 @@ private DynamicObject functionTemplateCreateCallback(JSContext context, JSRealm
17601761
functionData.setCallTarget(callTarget);
17611762
functionData.setConstructTarget(constructTarget);
17621763
functionData.setConstructNewTarget(constructNewTarget);
1763-
template.setFunctionData(functionData);
17641764
}
17651765

17661766
DynamicObject functionObject = JSFunction.create(realm, functionData);

0 commit comments

Comments
 (0)