Buggy code:
graph = ProgramUtils . buildControlFlowGraph ( method . getProgram ( ) ) ; indexer = new GraphIndexer ( graph ) ; graph = indexer . getGraph ( ) ; loopGraph = new LoopGraph ( this . graph ) ; unflatCode ( ) ; Program program = method . getProgram ( ) ; blockMap = new Decompiler . Block [ ( ( program . basicBlockCount ( ) ) * 2 ) + 1 ] ; Deque < Decompiler . Block > stack = new ArrayDeque < > ( ) ; BlockStatement rootStmt = new BlockStatement ( ) ; rootStmt . setId ( "root" ) ; stack . push ( new Decompiler . Block ( rootStmt , rootStmt . getBody ( ) , ( - 1 ) , ( - 1 ) ) ) ; StatementGenerator generator = new StatementGenerator ( ) ; generator . classSource = classSource ; generator . program = program ; generator . blockMap = blockMap ; generator . indexer = indexer ; parentNode = codeTree . getRoot ( ) ; currentNode = parentNode . getFirstChild ( ) ; for ( int i = 0 ; i < ( this . graph . size ( ) ) ; ++ i ) { Decompiler . Block block = stack . peek ( ) ; while ( ( block . end ) == i ) { Decompiler . Block oldBlock = block ; stack . pop ( ) ; block = stack . peek ( ) ; if ( ( block . start ) >= 0 ) { int mappedStart = indexer . nodeAt ( block . start ) ; if ( ( blockMap [ mappedStart ] ) == oldBlock ) { blockMap [ mappedStart ] = block ; } } } while ( ( parentNode . getEnd ( ) ) == i ) { currentNode = parentNode . getNext ( ) ; parentNode = parentNode . getParent ( ) ; } for ( Decompiler . Block newBlock : createBlocks ( i ) ) { block . body . add ( newBlock . statement ) ; stack . push ( newBlock ) ; block = newBlock ; } int node = ( i < ( indexer . size ( ) ) ) ? indexer . nodeAt ( i ) : - 1 ; int next = i + 1 ; int head = loops [ i ] ; if ( ( head != ( - 1 ) ) && ( ( loopSuccessors [ head ] ) == next ) ) { next = head ; } if ( node >= 0 ) { generator . currentBlock = program . basicBlockAt ( node ) ; int tmp = indexer . nodeAt ( next ) ; generator . nextBlock = ( ( tmp >= 0 ) && ( next < ( indexer . size ( ) ) ) ) ? program . basicBlockAt ( tmp ) : null ; generator . statements . clear ( ) ; InstructionLocation lastLocation = null ; NodeLocation nodeLocation = null ; for ( Instruction insn : generator . currentBlock . getInstructions ( ) ) { if ( ( ( insn . getLocation ( ) ) != null ) && ( lastLocation != ( insn . getLocation ( ) ) ) ) { lastLocation = insn . getLocation ( ) ; nodeLocation = new NodeLocation ( lastLocation . getFileName ( ) , lastLocation . getLine ( ) ) ; } if ( ( insn . getLocation ( ) ) != null ) { generator . setCurrentLocation ( nodeLocation ) ; } insn . acceptVisitor ( generator ) ; } for ( TryCatchBlock tryCatch : generator . currentBlock . getTryCatchBlocks ( ) ) { TryCatchStatement tryCatchStmt = new TryCatchStatement ( ) ; tryCatchStmt . setExceptionType ( tryCatch . getExceptionType ( ) ) ; tryCatchStmt . setExceptionVariable ( tryCatch . getExceptionVariable ( ) . getIndex ( ) ) ; tryCatchStmt . getProtectedBody ( ) . addAll ( generator . statements ) ; generator . statements . clear ( ) ; generator . statements . add ( tryCatchStmt ) ; Statement handlerStmt = generator . generateJumpStatement ( tryCatch . getHandler ( ) ) ; if ( handlerStmt != null ) { tryCatchStmt . getHandler ( ) . add ( handlerStmt ) ; } } block . body . addAll ( generator . statements ) ; } } SequentialStatement result = new SequentialStatement ( ) ; result . getSequence ( ) . addAll ( rootStmt . getBody ( ) ) ; MethodReference reference = new MethodReference ( method . getOwnerName ( ) , method . getDescriptor ( ) ) ; RegularMethodNode methodNode = new RegularMethodNode ( reference ) ; methodNode . getModifiers ( ) . addAll ( mapModifiers ( method . getModifiers ( ) ) ) ; methodNode . setBody ( result ) ; for ( int i = 0 ; i < ( program . variableCount ( ) ) ; ++ i ) { methodNode . getVariables ( ) . add ( program . variableAt ( i ) . getRegister ( ) ) ; } Optimizer optimizer = new Optimizer ( ) ; optimizer . optimize ( methodNode , method . getProgram ( ) ) ; methodNode . getModifiers ( ) . addAll ( mapModifiers ( method . getModifiers ( ) ) ) ; <START_BUG> int paramCount = method . getSignature ( ) . length ; <END_BUG> for ( int i = 0 ; i < paramCount ; ++ i ) { Variable var = program . variableAt ( i ) ; methodNode . getParameterDebugNames ( ) . add ( new HashSet ( var . getDebugNames ( ) ) ) ; } return methodNode ; } private Set < NodeModifier > mapModifiers ( Set < ElementModifier > modifiers ) { } private List < Decompiler . Block > createBlocks ( int start ) { } private boolean isSingleBlockLoop ( int index ) { } private void unflatCode ( ) { } }

Fix:
int paramCount = Math . min ( method . getSignature ( ) . length , program . variableCount ( ) ) ;