From a285443d19f95d03e7cc336e4edff770b0d30197 Mon Sep 17 00:00:00 2001 From: nikitosing Date: Fri, 25 Jun 2021 11:04:45 +0700 Subject: [PATCH] Fix /decompiled-contracts bug --- CHANGELOG.md | 1 + .../block_scout_web/views/address_decompiled_contract_view.ex | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd017b35c0..4b32bd669e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - [#4067](https://github.com/blockscout/blockscout/pull/4067) - Display LP tokens USD value and custom metadata in tokens dropdown at address page ### Fixes +- [#4316](https://github.com/blockscout/blockscout/pull/4316) - Fix `/decompiled-contracts` bug - [#4310](https://github.com/blockscout/blockscout/pull/4310) - Fix logo URL redirection, set font-family defaults for chart.js - [#4308](https://github.com/blockscout/blockscout/pull/4308) - Fix internal server error on contract verification options page - [#4307](https://github.com/blockscout/blockscout/pull/4307) - Fix for composing IPFS URLs for NFTs images diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_decompiled_contract_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_decompiled_contract_view.ex index 438f344199..4e06e377dc 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/address_decompiled_contract_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/address_decompiled_contract_view.ex @@ -230,6 +230,10 @@ defmodule BlockScoutWeb.AddressDecompiledContractView do end) end + def last_decompiled_contract_version(decompiled_contracts) when is_nil(decompiled_contracts), do: nil + + def last_decompiled_contract_version(decompiled_contracts) when decompiled_contracts == [], do: nil + def last_decompiled_contract_version(decompiled_contracts) do Enum.max_by(decompiled_contracts, & &1.decompiler_version) end