aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java')
-rwxr-xr-xsrc/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java b/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java
index fe77248..45e0bf4 100755
--- a/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java
+++ b/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java
@@ -268,13 +268,15 @@ public class ProcAddressEmitter extends JavaEmitter
if (shouldWrap)
{
// Hoist argument names from function pointer if not supplied in prototype
- FunctionType typedef = typedefDictionary.get(funcPointerTypedefName).asPointer().getTargetType().asFunction();
- FunctionType fun = sym.getType();
- int numarg = typedef.getNumArguments();
- for ( int i =0; i < numarg; i++ )
- {
- if ( fun.getArgumentName(i) == null )
- fun.setArgumentName(i,typedef.getArgumentName(i));
+ Type funcPointerType = typedefDictionary.get(funcPointerTypedefName);
+ if (funcPointerType != null) {
+ FunctionType typedef = funcPointerType.asPointer().getTargetType().asFunction();
+ FunctionType fun = sym.getType();
+ int numarg = typedef.getNumArguments();
+ for (int i =0; i < numarg; i++) {
+ if (fun.getArgumentName(i) == null)
+ fun.setArgumentName(i,typedef.getArgumentName(i));
+ }
}
}