Skip to content

Commit

Permalink
Fix this Metamorph crash when navigating with arrow keys into empty C…
Browse files Browse the repository at this point in the history
…hameleon section
  • Loading branch information
mchorse committed Jul 30, 2021
1 parent 5105a08 commit dac379a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ version=1.2.9
mclib=2.3.1

mc_version=1.12.2
forge_version=14.23.2.2611
forge_version=14.23.5.2799
snapshot=snapshot_20171003
6 changes: 4 additions & 2 deletions src/main/java/mchorse/metamorph/client/gui/GuiMorphs.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

public class GuiMorphs extends GuiScrollElement
{
private static final MorphCategory EMPTY_CATEGORY = new MorphCategory(null, null);

/**
* Cached previous filter. Used for avoiding double recalculations
*/
Expand Down Expand Up @@ -105,7 +107,7 @@ else if (y > 0 && this.isLastCategory(this.selected))
}

section = this.sections.get(sectionIndex);
category = section.section.categories.get(section.section.categories.size() - 1);
category = section.section.categories.isEmpty() ? EMPTY_CATEGORY : section.section.categories.get(section.section.categories.size() - 1);
}
else if (index >= section.section.categories.size())
{
Expand All @@ -117,7 +119,7 @@ else if (index >= section.section.categories.size())
}

section = this.sections.get(sectionIndex);
category = section.section.categories.get(0);
category = section.section.categories.isEmpty() ? EMPTY_CATEGORY : section.section.categories.get(0);
}
else
{
Expand Down

0 comments on commit dac379a

Please sign in to comment.