From 2912119d95a7e57bf42e979bc867812d87c8e039 Mon Sep 17 00:00:00 2001 From: Theo Dowling Date: Wed, 26 Oct 2016 18:10:36 +0200 Subject: [PATCH] Resolve build warnings --- lib/battleship/game.ex | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/battleship/game.ex b/lib/battleship/game.ex index f9531f2..af7e549 100644 --- a/lib/battleship/game.ex +++ b/lib/battleship/game.ex @@ -88,9 +88,11 @@ defmodule Battleship.Game do opponent_id = get_opponents_id(game, player_id) - if opponent_id != nil do - game_data = Map.put(game_data, :opponents_board, Board.get_opponents_data(opponent_id)) - end + game_data = + case opponent_id do + nil -> game_data + _ -> Map.put(game_data, :opponents_board, Board.get_opponents_data(opponent_id)) + end {:reply, game_data, game} end