From 99350cd65119b03865b755b94db7409332f69c5e Mon Sep 17 00:00:00 2001 From: Daniel Sun Date: Mon, 9 Nov 2020 13:16:47 +0000 Subject: [PATCH] Fix abnormal program termination On line 196, the program checks for the 'QUIT' event. The pygame.quit function is called, but the program keeps running, attempting to draw on a screen that no longer exists, causing a crash. I've added a return statement on the next line so that the program terminates regularly instead of crashing. --- blackjack.py | 1 + 1 file changed, 1 insertion(+) diff --git a/blackjack.py b/blackjack.py index a704398..a8bb405 100644 --- a/blackjack.py +++ b/blackjack.py @@ -195,6 +195,7 @@ def main(): for event in pygame.event.get(): if event.type == QUIT: pygame.quit() + return elif event.type == pygame.MOUSEBUTTONDOWN and not (gameover or stand) and hitB.collidepoint(pygame.mouse.get_pos()): #gives player a card if they don't break blackjack rules card, cA = genCard(ccards, userCard)