From 5b2b5abf56d992de12900044ba8f003c1aadb10c Mon Sep 17 00:00:00 2001 From: syeyoung Date: Sat, 8 May 2021 23:45:05 +0900 Subject: Fix being able to crash while choosing cosmetics --- .../features/impl/cosmetics/PrefixSelectorGUI.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/PrefixSelectorGUI.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/PrefixSelectorGUI.java index b0c2987f..eca6228a 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/PrefixSelectorGUI.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/PrefixSelectorGUI.java @@ -148,15 +148,19 @@ public class PrefixSelectorGUI extends MPanel { selected = value; return; } - if (new Rectangle(161,cnt * (fr.FONT_HEIGHT+4) + 2,58,fr.FONT_HEIGHT+1).contains(relX, relY) && cosmeticsManager.getPerms().contains(value.getReqPerm())) { - for (ActiveCosmetic activeCosmetic : activeCosmeticList) { - if (activeCosmetic.getCosmeticData().equals(value.getId())) { - cosmeticsManager.removeCosmetic(activeCosmetic); - return; + try { + if (new Rectangle(161, cnt * (fr.FONT_HEIGHT + 4) + 2, 58, fr.FONT_HEIGHT + 1).contains(relX, relY) && cosmeticsManager.getPerms().contains(value.getReqPerm())) { + for (ActiveCosmetic activeCosmetic : activeCosmeticList) { + if (activeCosmetic.getCosmeticData().equals(value.getId())) { + cosmeticsManager.removeCosmetic(activeCosmetic); + return; + } } + cosmeticsManager.setCosmetic(value); + selected = value; } - cosmeticsManager.setCosmetic(value); - selected = value; + } catch (Exception e) { + e.printStackTrace(); } cnt++; -- cgit