Merge pull request #371 from sschr15/master
fix bugs occurring on Windows when trying to generate the method list
This commit is contained in:
		
						commit
						75f025134d
					
				
					 1 changed files with 13 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -1,9 +1,12 @@
 | 
			
		|||
package the.bytecode.club.bytecodeviewer.gui.components;
 | 
			
		||||
 | 
			
		||||
import java.awt.Component;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import javax.swing.JLabel;
 | 
			
		||||
import javax.swing.JList;
 | 
			
		||||
import javax.swing.ListCellRenderer;
 | 
			
		||||
 | 
			
		||||
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.BytecodeViewPanel;
 | 
			
		||||
import the.bytecode.club.bytecodeviewer.gui.util.BytecodeViewPanelUpdater;
 | 
			
		||||
import the.bytecode.club.bytecodeviewer.util.MethodParser;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -44,8 +47,16 @@ public class MethodsRenderer extends JLabel implements ListCellRenderer<Object>
 | 
			
		|||
	public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected,
 | 
			
		||||
	                                              boolean cellHasFocus)
 | 
			
		||||
	{
 | 
			
		||||
		MethodParser methods = bytecodeViewPanelUpdater.viewer.methods.get(bytecodeViewPanelUpdater.bytecodeViewPanel.decompiler.ordinal());
 | 
			
		||||
		MethodParser.Method method = methods.getMethod((Integer) value);
 | 
			
		||||
		int methodIndex = (Integer) value;
 | 
			
		||||
		MethodParser methods;
 | 
			
		||||
		List<MethodParser> methodParsers = bytecodeViewPanelUpdater.viewer.methods;
 | 
			
		||||
		BytecodeViewPanel bytecodeViewPanel = bytecodeViewPanelUpdater.bytecodeViewPanel;
 | 
			
		||||
		try {
 | 
			
		||||
			methods = methodParsers.get(bytecodeViewPanel.decompiler.ordinal());
 | 
			
		||||
		} catch (ArrayIndexOutOfBoundsException e) {
 | 
			
		||||
			methods = methodParsers.get(bytecodeViewPanel.panelIndex);
 | 
			
		||||
		}
 | 
			
		||||
		MethodParser.Method method = methods.getMethod(methodIndex);
 | 
			
		||||
		setText(method.toString());
 | 
			
		||||
		return this;
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue