Fix ArrayIndexOutOfRange with temp variable

This commit is contained in:
Volker Berlin 2019-02-17 09:52:04 +01:00
parent 99f7248fc8
commit 6246840f90

View File

@ -394,9 +394,12 @@ public class ModuleGenerator {
type = localTypes.get( i ); type = localTypes.get( i );
String paramName = null; String paramName = null;
if( variables != null ) { if( variables != null ) {
LocalVariable variable = variables.getPosition( paramCount + i ); int idx = paramCount + i;
if( variable != null ) { if( idx < variables.getPositionSize() ) {
paramName = variable.getName(); LocalVariable variable = variables.getPosition( idx );
if( variable != null ) {
paramName = variable.getName();
}
} }
} }
writer.writeMethodParam( "local", type, paramName ); writer.writeMethodParam( "local", type, paramName );