fix (somehow many?) bugs occurring on (seemingly only) Windows

This commit is contained in:
sschr15 2021-11-14 12:44:43 -06:00
parent 36515d09d5
commit 34285c27b4
No known key found for this signature in database
GPG key ID: 23B63CAF5653B1E2
2 changed files with 14 additions and 3 deletions

View file

@ -3,7 +3,7 @@
<groupId>the.bytecode.club</groupId>
<artifactId>Bytecode-Viewer</artifactId>
<version>2.10.16</version>
<version>2.10.17</version>
<properties>
<!-- Project settings -->

View file

@ -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;
}