Fix crash on payment with Channel

This commit is contained in:
tool4EvEr
2021-06-03 10:39:50 +02:00
parent 196b48cbd3
commit 1af8cee719
2 changed files with 9 additions and 7 deletions

View File

@@ -66,12 +66,14 @@ public abstract class InputPayMana extends InputSyncronizedBase {
@Override
protected void onStop() {
// Clear current Mana cost being paid for SA
saPaidFor.setManaCostBeingPaid(null);
player.popPaidForSA();
if (!isFinished()) {
// Clear current Mana cost being paid for SA
saPaidFor.setManaCostBeingPaid(null);
player.popPaidForSA();
if (wasFloatingMana) { //hide mana pool if it was shown due to floating mana
getController().getGui().hideManaPool(PlayerView.get(player));
if (wasFloatingMana) { //hide mana pool if it was shown due to floating mana
getController().getGui().hideManaPool(PlayerView.get(player));
}
}
}

View File

@@ -36,8 +36,6 @@ public abstract class InputSyncronizedBase extends InputBase implements InputSyn
}
protected final void stop() {
onStop();
// ensure input won't accept any user actions.
FThreads.invokeInEdtNowOrLater(new Runnable() {
@Override
@@ -46,6 +44,8 @@ public abstract class InputSyncronizedBase extends InputBase implements InputSyn
}
});
onStop();
// thread irrelevant
if (getController().getInputQueue().getInput() != null) {
getController().getInputQueue().removeInput(InputSyncronizedBase.this);