From fd1c691c2e11e1dcfc6f84143e5152c5cd14b45b Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 25 Jun 2023 07:43:50 +0200 Subject: JavaEmitter.generateArrayGetterSetterCode(): Place elemCountExpr null check where it could occur -> non-opaque, non-primitive array case --- src/java/com/jogamp/gluegen/JavaEmitter.java | 15 +++++++-------- 1 file 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 { -- cgit v1.2.3