From 7bc9d94c066fc7bbe42e079b610d909df0a862c5 Mon Sep 17 00:00:00 2001 From: Tim Mecklem Date: Thu, 12 Jul 2018 15:33:50 -0400 Subject: [PATCH] Match on nil so that Ecto NotLoaded raises a no function match error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If an Address association isn’t preloaded, we want the page to crash for now since it’s not valid to try to render an address that hasn’t been fetched. Co-authored-by: Stamates --- apps/explorer_web/lib/explorer_web/views/address_view.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/explorer_web/lib/explorer_web/views/address_view.ex b/apps/explorer_web/lib/explorer_web/views/address_view.ex index 706e53979b..800c99cce0 100644 --- a/apps/explorer_web/lib/explorer_web/views/address_view.ex +++ b/apps/explorer_web/lib/explorer_web/views/address_view.ex @@ -35,7 +35,7 @@ defmodule ExplorerWeb.AddressView do def contract?(%Address{contract_code: _}), do: true - def contract?(_), do: true + def contract?(nil), do: true def formatted_usd(%Address{fetched_balance: nil}, _), do: nil