Skip to content

Commit

Permalink
fix a potential out of bounds access error in determineCurrentTetrimino
Browse files Browse the repository at this point in the history
  • Loading branch information
rystills committed Mar 14, 2019
1 parent eba74f5 commit 0779c68
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/TSpinTutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class TSpinTutor extends JFrame {
private static final long serialVersionUID = 1L;
//global random generator
static Random rand = new Random();
static boolean showDebugInfo = true;
static boolean showDebugInfo = false;
//graphics constants
static enum Tetrimino {
I(0,0,1,0,2,0,3,0),
Expand Down Expand Up @@ -202,7 +202,7 @@ public static void determineCurrentTetrimino() {
shadowCols[0] = shadowCols[1] = shadowCols[2] = shadowCols[3] = -1;
curShadowCol = 0;
for (int x = 0; x <= gridRight-gridLeft; x+= bSize) {
for (int y = 0; y <= gridBot-gridTop; y += bSize) {
for (int y = 0; y <= gridBot-gridTop && curShadowCol <= 3; y += bSize) {
switch (capture.getRGB(x,y)) {
case -8335379: //I block
curBlock = Tetrimino.I;
Expand Down

0 comments on commit 0779c68

Please sign in to comment.