diff options
author | Sven Gothel <[email protected]> | 2023-06-25 07:43:50 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-06-25 07:43:50 +0200 |
commit | fd1c691c2e11e1dcfc6f84143e5152c5cd14b45b (patch) | |
tree | 287898db9079f9eddc2edb3ba7fe363580114b69 | |
parent | 069c5f69d22c8979728149a51a089b52712cac5c (diff) |
JavaEmitter.generateArrayGetterSetterCode(): Place elemCountExpr null check where it could occur -> non-opaque, non-primitive array case
-rw-r--r-- | src/java/com/jogamp/gluegen/JavaEmitter.java | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/java/com/jogamp/gluegen/JavaEmitter.java b/src/java/com/jogamp/gluegen/JavaEmitter.java index dea2249..636927d 100644 --- a/src/java/com/jogamp/gluegen/JavaEmitter.java +++ b/src/java/com/jogamp/gluegen/JavaEmitter.java @@ -1675,6 +1675,13 @@ public class JavaEmitter implements GlueEmitter { final int[][] arrayLengthRes = new int[1][]; final boolean[] _useFixedArrayLen = { false }; elemCountExpr = getArrayArrayLengthExpr(fieldType.asArray(), fqStructFieldName, _useFixedArrayLen, arrayLengthRes); + if( null == elemCountExpr ) { + final String msg = "SKIP unsized array in struct: "+fqStructFieldName+": "+fieldType.getSignature(null).toString(); + unit.emitln(" // "+msg); + unit.emitln(); + LOG.log(WARNING, structCType.getASTLocusTag(), msg); + return; + } // final int arrayLength = arrayLengthRes[0][0]; constElemCount = _useFixedArrayLen[0]; ownership = Ownership.Parent; // a fixed linear array @@ -1732,14 +1739,6 @@ public class JavaEmitter implements GlueEmitter { staticElemCount = _staticElemCount; } } - if( null == elemCountExpr ) { - final String msg = "SKIP unsized array in struct: "+fqStructFieldName+": "+fieldType.getSignature(null).toString(); - unit.emitln(" // "+msg); - unit.emitln(); - LOG.log(WARNING, structCType.getASTLocusTag(), msg); - throw new InternalError(msg); - // return; // FIXME: Remove block unreachable - } boolean _maxOneElement = cfg.maxOneElement(fqStructFieldName); if( !_maxOneElement ) { try { |