Skip to content

Commit

Permalink
fix: Do not crash if there are no buttons in the in-game menu (fixes #14
Browse files Browse the repository at this point in the history
)
  • Loading branch information
magicus committed Apr 20, 2024
1 parent d218d3b commit f844961
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ private static void injectModSettingsButton(Screen screen, List<ClickableWidget>
} else {
if (savedButton == null) {
// There is no "Options..." button. Just grab an arbitrary button
if (buttons.isEmpty()) {
// There are no existing buttons? Just try to add our button
ClickableWidget msbutton = new ModSettingsButton(screen.width / 2 - fullButtonWidth / 2,
108 - verticalOffset, fullButtonWidth, BUTTON_HEIGHT, screen);
buttons.add(msbutton);
return;
}
savedButton = buttons.get(0);
}
// Shift all buttons starting at "Options..." down
Expand Down

0 comments on commit f844961

Please sign in to comment.