summaryrefslogtreecommitdiffstats
path: root/src/antlr/com/jogamp/gluegen/cgram/HeaderParser.g
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-03-09 04:24:03 +0100
committerSven Gothel <[email protected]>2015-03-09 04:24:03 +0100
commit8efdf71e2de6392344326ba6a28e8f8fa7e3e8e5 (patch)
tree75a1c852f2be3bcb4893213b141669930bb893d8 /src/antlr/com/jogamp/gluegen/cgram/HeaderParser.g
parent90e53d0c01f2fe62ff8c5bcc41741ec3c9c47e59 (diff)
Bug 1134 - In case of 'undefined type' throw a semantic GlueGenException instead of an NPE
Diffstat (limited to 'src/antlr/com/jogamp/gluegen/cgram/HeaderParser.g')
-rw-r--r--src/antlr/com/jogamp/gluegen/cgram/HeaderParser.g8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/antlr/com/jogamp/gluegen/cgram/HeaderParser.g b/src/antlr/com/jogamp/gluegen/cgram/HeaderParser.g
index 9ec3b9b..8826c13 100644
--- a/src/antlr/com/jogamp/gluegen/cgram/HeaderParser.g
+++ b/src/antlr/com/jogamp/gluegen/cgram/HeaderParser.g
@@ -520,7 +520,13 @@ parameterDeclaration returns [ParameterDeclaration pd] {
: #( NParameterDeclaration
tb = declSpecifiers
(decl = declarator[tb] | nonemptyAbstractDeclarator[tb])?
- ) { pd = new ParameterDeclaration(decl, tb.type()); }
+ ) {
+ if( null == tb ) {
+ throwGlueGenException(parameterDeclaration_AST_in,
+ String.format("Undefined type for declaration '%s'", decl));
+ }
+ pd = new ParameterDeclaration(decl, tb.type());
+ }
;
functionDef {