mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 16:26:40 -04:00
prevent infinite loop with invalid template
This commit is contained in:
parent
b0091053bf
commit
f8e1ebd4fb
1 changed files with 6 additions and 0 deletions
|
@ -108,7 +108,13 @@ class Template:
|
||||||
|
|
||||||
def render_tags(self, template, context):
|
def render_tags(self, template, context):
|
||||||
"""Renders all the tags in a template for a context."""
|
"""Renders all the tags in a template for a context."""
|
||||||
|
repCount = 0
|
||||||
while 1:
|
while 1:
|
||||||
|
if repCount > 100:
|
||||||
|
print("too many replacements")
|
||||||
|
break
|
||||||
|
repCount += 1
|
||||||
|
|
||||||
match = self.tag_re.search(template)
|
match = self.tag_re.search(template)
|
||||||
if match is None:
|
if match is None:
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in a new issue