Fix freezing tree game with empty database

Fix the bug that makes the program freeze when the user click the "All game" in the game tree with no game in it.

Reported-by: hlong290494
Signed-off: Long Nguyen Duc Hoang <lhnguyenduc@wpi.edu>