diff --git a/src/main/java/com/cleanroommc/modularui/screen/ModularPanel.java b/src/main/java/com/cleanroommc/modularui/screen/ModularPanel.java index 4ac6eb99..76d3e892 100644 --- a/src/main/java/com/cleanroommc/modularui/screen/ModularPanel.java +++ b/src/main/java/com/cleanroommc/modularui/screen/ModularPanel.java @@ -107,12 +107,13 @@ public boolean isOpen() { * @param animate true if the closing animation should play first. */ public void closeIfOpen(boolean animate) { + if (!isOpen()) return; closeSubPanels(); if (!animate || !shouldAnimate()) { this.screen.getPanelManager().closePanel(this); return; } - if (isOpen() && !isOpening() && !isClosing()) { + if (!isOpening() && !isClosing()) { if (isMainPanel()) { // if this is the main panel, start closing animation for all panels for (ModularPanel panel : getScreen().getPanelManager().getOpenPanels()) {