Browse Source

runtime: fix list access for last element

Jared Flatow 11 years ago
parent
commit
1149e0ca14
1 changed files with 1 additions and 1 deletions
  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) ->