commit 56ce9aa079e57ac053f1792170bdebba594d6a6e parent 7a3e8fcee5048e7960ee1950c8e30d6e7a3671be Author: Michael Neuper <michael@michaelneuper.com> Date: Fri, 28 Apr 2023 17:16:05 +0200 Fix bug where balance goes into negative Diffstat:
| M | src/controller/Controller.java | | | 6 | ++++++ |
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/controller/Controller.java b/src/controller/Controller.java @@ -132,6 +132,12 @@ public class Controller { * @return a message indicating the result of the game */ public String checkWhoWins() { + + // check wether player has enough money + if (bet > PLAYER.getBalance()) { + JOptionPane.showMessageDialog(null, "You don't have enough money"); + return null; + } // check if dealer has blackjack if (DEALER.hasBlackjack()) {