Bug 477

Summary: NullPointerException when the pieces fill the playing field
Product: Group16_Tetris Fighter Reporter: ywyim5-c
Component: GameControllerAssignee: Ashley <tecchk.cy>
Status: CONFIRMED ---    
Severity: major CC: lfeng23-c
Priority: High    
Version: V2   
Hardware: PC   
OS: Windows   
Deadline: 2020-10-30   
Attachments: Screenshot of the bug of null pointer

Description ywyim5-c 2020-11-26 13:35:49 HKT
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
Comment 1 ywyim5-c 2020-11-26 13:39:10 HKT
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);
Comment 2 FENG Li 2020-11-26 13:40:40 HKT
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);