Created attachment 52 [details] Screenshot of the bug of null pointer Overview: There would be a null pointer exception when the pieces reach the top of the playing field in BoardPanel, and the page for the game over won't display as expected. Steps to reproduce: Step1: run the main function in the Main class Step2: continuously play the game until the pieces reach the top Step3: the error would occur. Actual Results: Exception in thread "main": java.lang.NullPointerException at gui.pieceController.spawnPiece Expected Results: The 'Game Over' page should be shown and no error would occur. Build Date & Hardware: Build 2020-10-9 on Mac OS Catalina 10.15.6 Additional Builds and Platforms: Build 2020-10-11 on Mac OS Catalina 10.15.6
The exception was caused by the wrong logic. To solve this exception, we swap the following two lines of code. this.logicTimer = new Clock(gameSpeed); pc = new PieceController(this);