gtk-demo: Fix a crash in the puzzle

Avoid a crash when clicking the refresh button
after solving the puzzle.
This commit is contained in:
Matthias Clasen 2020-06-01 00:10:42 -04:00
parent 382153e82d
commit cc878160bd

View File

@ -355,11 +355,16 @@ reshuffle (void)
{
GtkWidget *grid;
grid = gtk_aspect_frame_get_child (GTK_ASPECT_FRAME (frame));
if (solved)
start_puzzle (puzzle);
{
start_puzzle (puzzle);
grid = gtk_aspect_frame_get_child (GTK_ASPECT_FRAME (frame));
}
else
shuffle_puzzle (grid);
{
grid = gtk_aspect_frame_get_child (GTK_ASPECT_FRAME (frame));
shuffle_puzzle (grid);
}
gtk_widget_grab_focus (grid);
}