Skip to content

Commit bc1bfa9

Browse files
YaSuenagvjovanov
authored andcommitted
Allow NULL for result in poly_context_eval / poly_value_execute
1 parent 39f111b commit bc1bfa9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

substratevm/src/org.graalvm.polyglot.nativeapi/src/org/graalvm/polyglot/nativeapi/PolyglotNativeAPI.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,10 @@ public static PolyglotStatus poly_context_eval(PolyglotIsolateThread thread, Pol
481481
String jCode = CTypeConversion.toJavaString(source_utf8);
482482

483483
Source sourceCode = Source.newBuilder(languageName, jCode, jName).build();
484-
result.write(createHandle(c.eval(sourceCode)));
484+
Value evalResult = c.eval(sourceCode);
485+
if (result.isNonNull()) {
486+
result.write(createHandle(evalResult));
487+
}
485488
});
486489
}
487490

@@ -587,7 +590,9 @@ public static PolyglotStatus poly_value_execute(PolyglotIsolateThread thread, Po
587590
}
588591

589592
Value resultValue = function.execute(jArgs);
590-
result.write(createHandle(resultValue));
593+
if (result.isNonNull()) {
594+
result.write(createHandle(resultValue));
595+
}
591596
});
592597
}
593598

0 commit comments

Comments
 (0)