summaryrefslogtreecommitdiffstats
path: root/opengl/tools/glgen/src/JniCodeEmitter.java
diff options
context:
space:
mode:
Diffstat (limited to 'opengl/tools/glgen/src/JniCodeEmitter.java')
-rw-r--r--opengl/tools/glgen/src/JniCodeEmitter.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/opengl/tools/glgen/src/JniCodeEmitter.java b/opengl/tools/glgen/src/JniCodeEmitter.java
index 726dc61..774f40c 100644
--- a/opengl/tools/glgen/src/JniCodeEmitter.java
+++ b/opengl/tools/glgen/src/JniCodeEmitter.java
@@ -1227,7 +1227,12 @@ public class JniCodeEmitter {
String array = numBufferArgs <= 1 ? "_array" :
"_" + cfunc.getArgName(cIndex) + "Array";
- out.println(indent + "if (" + cname +" == NULL) {");
+ boolean nullAllowed = isNullAllowed(cfunc) || isPointerFunc;
+ if (nullAllowed) {
+ out.println(indent + "if (" + cname + "_buf && " + cname +" == NULL) {");
+ } else {
+ out.println(indent + "if (" + cname +" == NULL) {");
+ }
out.println(indent + indent + "char * _" + cname + "Base = (char *)_env->GetPrimitiveArrayCritical(" + array + ", (jboolean *) 0);");
out.println(indent + indent + cname + " = (" +cfunc.getArgType(cIndex).getDeclaration() +") (_" + cname + "Base + " + bufferOffset + ");");
out.println(indent + "}");