Skip to content

Commit a10b1fb

Browse files
committed
Fix crash in client template when game creation fails
1 parent eefa22b commit a10b1fb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

templates/new/client/game.go.tmpl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ func Init(config GameConfig) (*Game, error) {
9696
} else {
9797
game, joinSecret, err = CreateAndJoinGame(public, protected, pflag.Arg(1), config)
9898
}
99-
fmt.Println("Game ID:", game.Id)
99+
if game != nil {
100+
fmt.Println("Game ID:", game.Id)
101+
}
100102
if joinSecret != "" {
101103
fmt.Println("Join secret:", joinSecret)
102104
}

0 commit comments

Comments
 (0)