This commit is contained in:
ShirosakiMio 2024-07-02 19:34:10 +08:00
parent 9de6989914
commit 40e0c330b2
1 changed files with 6 additions and 2 deletions

View File

@ -141,8 +141,12 @@ public class GameOption {
/** @return The stored Minecraft GUI scale, also auto-computed if on auto-mode or improper setting */ /** @return The stored Minecraft GUI scale, also auto-computed if on auto-mode or improper setting */
public int getGuiScale(int width, int height, int iscale) { public int getGuiScale(int width, int height, int iscale) {
String str = get("guiScale"); String str = get("guiScale");
int guiScale = (str == null ? 0 : Integer.parseInt(str)); int guiScale;
try {
guiScale = (str == null ? 0 : Integer.parseInt(str));
} catch (NumberFormatException ignore) {
guiScale = 0;
}
int scale = Math.max(Math.min(width / 320, height / 240), 1); int scale = Math.max(Math.min(width / 320, height / 240), 1);
if (scale < guiScale || guiScale == 0) { if (scale < guiScale || guiScale == 0) {
guiScale = scale; guiScale = scale;