aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Göthel <[email protected]>2024-01-05 13:04:29 +0100
committerSven Göthel <[email protected]>2024-01-05 13:04:29 +0100
commitdccb9a85e39cf82bd32ef28cb0202e2d486328ec (patch)
treea01544f99775c9ecb9087f7c05bf1922e7a217c3
parente3b10d335cc2fb659bb5bd3d8ab82e93eb36080c (diff)
parentd56cd13883c2af1f42906a5327c78b1a7c684012 (diff)
Merge remote-tracking branch 'Mathieu_Fery/1482-npe-on-java-callback-call-with-native-null-ptr'
-rw-r--r--src/java/com/jogamp/gluegen/JavaCallbackEmitter.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/java/com/jogamp/gluegen/JavaCallbackEmitter.java b/src/java/com/jogamp/gluegen/JavaCallbackEmitter.java
index 247d3ac..8263372 100644
--- a/src/java/com/jogamp/gluegen/JavaCallbackEmitter.java
+++ b/src/java/com/jogamp/gluegen/JavaCallbackEmitter.java
@@ -878,7 +878,8 @@ public final class JavaCallbackEmitter {
final String baseArgName = info.cbFuncBinding.getArgumentName(i);
if( i != info.cbFuncUserParamIdx && currentJavaType.isCompoundTypeWrapper() ) {
final String cBaseArgName = CodeGenUtils.capitalizeString( baseArgName );
- unit.emit( "(*env)->CallStaticObjectMethod(env, cbClazzArg" + cBaseArgName + ", cbMethodArg" + cBaseArgName + ", " + baseArgName + "_jni)" );
+ final String jniArgName = baseArgName + "_jni";
+ unit.emit( jniArgName + " != NULL ? " + "(*env)->CallStaticObjectMethod(env, cbClazzArg" + cBaseArgName + ", cbMethodArg" + cBaseArgName + ", " + jniArgName + ") : NULL" );
} else {
unit.emit( baseArgName + "_jni" );
}