1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Make sure Haml::Buffer never errors out because of negative tab counts.

The code in there is complex enough that it's a good idea to be defensive here,
even if we don't have any idea why negative tabs might actually come up.
This commit is contained in:
Nathan Weizenbaum 2008-06-06 13:31:00 -07:00
parent 21147927fd
commit 6f61019054

View file

@ -199,7 +199,7 @@ module Haml
@@tab_cache = {}
# Gets <tt>count</tt> tabs. Mostly for internal use.
def tabs(count = 0)
tabs = count + @tabulation
tabs = [count + @tabulation, 0].max
@@tab_cache[tabs] ||= ' ' * tabs
end