Просмотр исходного кода

catch all clause at the end for find_value/2

dcy 10 лет назад
Родитель
Сommit
7d306faff6
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      src/erlydtl_runtime.erl

+ 3 - 3
src/erlydtl_runtime.erl

@@ -72,8 +72,6 @@ find_value(Key, L) when is_integer(Key), is_list(L) ->
     if Key =< length(L) -> lists:nth(Key, L);
        true -> undefined
     end;
-find_value(Key, L) when is_atom(Key), is_binary(L) ->
-    undefined;
 find_value(Key, {GBSize, GBData}) when is_integer(GBSize) ->
     case gb_trees:lookup(Key, {GBSize, GBData}) of
         {value, Val} ->
@@ -109,7 +107,9 @@ find_value(Key, Tuple) when is_tuple(Tuple) ->
                 _ ->
                     undefined
             end
-    end.
+    end;
+find_value(_, _) ->
+    undefined.
 
 fetch_value(Key, Data, Options) ->
     fetch_value(Key, Data, Options, []).