Skip to content

Commit dac379a

Browse files
committed
Fix this Metamorph crash when navigating with arrow keys into empty Chameleon section
1 parent 5105a08 commit dac379a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ version=1.2.9
33
mclib=2.3.1
44

55
mc_version=1.12.2
6-
forge_version=14.23.2.2611
6+
forge_version=14.23.5.2799
77
snapshot=snapshot_20171003

src/main/java/mchorse/metamorph/client/gui/GuiMorphs.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
public class GuiMorphs extends GuiScrollElement
1616
{
17+
private static final MorphCategory EMPTY_CATEGORY = new MorphCategory(null, null);
18+
1719
/**
1820
* Cached previous filter. Used for avoiding double recalculations
1921
*/
@@ -105,7 +107,7 @@ else if (y > 0 && this.isLastCategory(this.selected))
105107
}
106108

107109
section = this.sections.get(sectionIndex);
108-
category = section.section.categories.get(section.section.categories.size() - 1);
110+
category = section.section.categories.isEmpty() ? EMPTY_CATEGORY : section.section.categories.get(section.section.categories.size() - 1);
109111
}
110112
else if (index >= section.section.categories.size())
111113
{
@@ -117,7 +119,7 @@ else if (index >= section.section.categories.size())
117119
}
118120

119121
section = this.sections.get(sectionIndex);
120-
category = section.section.categories.get(0);
122+
category = section.section.categories.isEmpty() ? EMPTY_CATEGORY : section.section.categories.get(0);
121123
}
122124
else
123125
{

0 commit comments

Comments
 (0)