diff --git a/Board.cpp b/Board.cpp index f8e22e8..7b26f47 100644 --- a/Board.cpp +++ b/Board.cpp @@ -233,6 +233,11 @@ bool Board::step() default: std::cerr << "WARNING: The ball is arrived at (" << ball->x << ", " << ball->y << "), but this cell is given no action." << std::endl; + if ((ball->x < 0) || (ball->x >= width)) { + continuing = false; + delete ball; + ball = nullptr; + } } return continuing;