From 8efdf71e2de6392344326ba6a28e8f8fa7e3e8e5 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 9 Mar 2015 04:24:03 +0100 Subject: Bug 1134 - In case of 'undefined type' throw a semantic GlueGenException instead of an NPE --- src/antlr/com/jogamp/gluegen/cgram/HeaderParser.g | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/antlr/com') 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 { -- cgit v1.2.3