Match on nil so that Ecto NotLoaded raises a no function match error

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 <stamates@hotmail.com>
pull/395/head
Tim Mecklem 6 years ago committed by Stamates
parent 54f188f009
commit 7bc9d94c06
  1. 2
      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

Loading…
Cancel
Save