Browse Source

Be precise about gb_trees struct to avoid problems with simple tuples

oxpa 10 years ago
parent
commit
c078160cf2
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/erlydtl_runtime.erl

+ 2 - 1
src/erlydtl_runtime.erl

@@ -72,7 +72,8 @@ 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, {GBSize, GBData}) when is_integer(GBSize) ->
+find_value(_, {0, nil}) -> undefined;
+find_value(Key, {GBSize, {_, _, _, _}=GBData}) when is_integer(GBSize) ->
     case gb_trees:lookup(Key, {GBSize, GBData}) of
         {value, Val} ->
             Val;