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

runtime: fix list access for last element

Jared Flatow 11 лет назад
Родитель
Сommit
1149e0ca14
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      src/erlydtl_runtime.erl

+ 1 - 1
src/erlydtl_runtime.erl

@@ -40,7 +40,7 @@ find_value(Key, L) when is_binary(Key), is_list(L) ->
         {Key, Value}    -> Value
     end;
 find_value(Key, L) when is_integer(Key), is_list(L) ->
-    if Key < length(L) -> lists:nth(Key, L);
+    if Key =< length(L) -> lists:nth(Key, L);
        true -> undefined
     end;
 find_value(Key, {GBSize, GBData}) when is_integer(GBSize) ->