Fix crash when quickly double-clicking the "Load"-replay button

This has previously been fixed for quadruple-clicking on the replay
itself but for some reason has not been fixed for simply double-clicking
the "Load" button.
This commit is contained in:
Jonas Herzig
2019-06-28 17:38:55 +02:00
parent 801f0871d5
commit c051b0ba3b

View File

@@ -76,8 +76,6 @@ public class GuiReplayViewer extends GuiScreen {
}).onSelectionDoubleClicked(() -> {
if (this.loadButton.isEnabled()) {
this.loadButton.onClick();
// Disable load button to prevent the player from opening the replay twice at the same time
this.loadButton.setDisabled();
}
});
@@ -88,6 +86,9 @@ public class GuiReplayViewer extends GuiScreen {
mod.startReplay(list.getSelected().file);
} catch (IOException e) {
e.printStackTrace();
} finally {
// Disable load button to prevent the player from opening the replay twice at the same time
loadButton.setDisabled();
}
}
}).setSize(150, 20).setI18nLabel("replaymod.gui.load").setDisabled();