Skip to content

Commit 75f0251

Browse files
authored
Merge pull request #371 from sschr15/master
fix bugs occurring on Windows when trying to generate the method list
2 parents 36515d0 + 8a5f186 commit 75f0251

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

src/main/java/the/bytecode/club/bytecodeviewer/gui/components/MethodsRenderer.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
package the.bytecode.club.bytecodeviewer.gui.components;
22

33
import java.awt.Component;
4+
import java.util.List;
45
import javax.swing.JLabel;
56
import javax.swing.JList;
67
import javax.swing.ListCellRenderer;
8+
9+
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.BytecodeViewPanel;
710
import the.bytecode.club.bytecodeviewer.gui.util.BytecodeViewPanelUpdater;
811
import the.bytecode.club.bytecodeviewer.util.MethodParser;
912

@@ -44,8 +47,16 @@ public MethodsRenderer(BytecodeViewPanelUpdater bytecodeViewPanelUpdater)
4447
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected,
4548
boolean cellHasFocus)
4649
{
47-
MethodParser methods = bytecodeViewPanelUpdater.viewer.methods.get(bytecodeViewPanelUpdater.bytecodeViewPanel.decompiler.ordinal());
48-
MethodParser.Method method = methods.getMethod((Integer) value);
50+
int methodIndex = (Integer) value;
51+
MethodParser methods;
52+
List<MethodParser> methodParsers = bytecodeViewPanelUpdater.viewer.methods;
53+
BytecodeViewPanel bytecodeViewPanel = bytecodeViewPanelUpdater.bytecodeViewPanel;
54+
try {
55+
methods = methodParsers.get(bytecodeViewPanel.decompiler.ordinal());
56+
} catch (ArrayIndexOutOfBoundsException e) {
57+
methods = methodParsers.get(bytecodeViewPanel.panelIndex);
58+
}
59+
MethodParser.Method method = methods.getMethod(methodIndex);
4960
setText(method.toString());
5061
return this;
5162
}

0 commit comments

Comments
 (0)