From 0a13e0225b4ca8af38d9731168cc17292c845f84 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 1 Jul 2019 17:25:18 +0300 Subject: [PATCH] fix test --- .../lib/ethereum_jsonrpc/rolling_window.ex | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/rolling_window.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/rolling_window.ex index 82e4a54072..0f83568f33 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/rolling_window.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/rolling_window.ex @@ -211,12 +211,16 @@ defmodule EthereumJSONRPC.RollingWindow do """ @spec inspect(table :: atom, key :: term()) :: nonempty_list(non_neg_integer) def inspect(table, key) do - case :ets.lookup(table, key) do - [{_, current_window, windows}] -> - [current_window | windows] - - _ -> - [] + if :ets.whereis(table) == :undefined do + [] + else + case :ets.lookup(table, key) do + [{_, current_window, windows}] -> + [current_window | windows] + + _ -> + [] + end end end end