Bug 477 - NullPointerException when the pieces fill the playing field
Summary: NullPointerException when the pieces fill the playing field
Status: CONFIRMED
Alias: None
Product: Group16_Tetris Fighter
Classification: Unclassified
Component: GameController (show other bugs)
Version: V2
Hardware: PC Windows
: High major
Deadline: 2020-10-30
Assignee: Ashley
URL:
Depends on:
Blocks:
 
Reported: 2020-11-26 13:35 HKT by ywyim5-c
Modified: 2020-11-26 13:40 HKT (History)
1 user (show)

See Also:


Attachments
Screenshot of the bug of null pointer (47.61 KB, image/png)
2020-11-26 13:35 HKT, ywyim5-c
Details

Note You need to log in before you can comment on or make changes to this bug.
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);