Avoid endless loops, e.g when an end_deeper is missing

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17225 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2007-02-16 18:33:36 +00:00
parent 6bf6c8453d
commit 2d6bc1d0aa

View File

@ -176,6 +176,8 @@ def find_beginning_of(lines, i, start_token, end_token):
count = 1 count = 1
while i > 0: while i > 0:
i = find_tokens_backwards(lines, [start_token, end_token], i-1) i = find_tokens_backwards(lines, [start_token, end_token], i-1)
if i == -1:
return -1
if check_token(lines[i], end_token): if check_token(lines[i], end_token):
count = count+1 count = count+1
else: else:
@ -190,6 +192,8 @@ def find_end_of(lines, i, start_token, end_token):
n = len(lines) n = len(lines)
while i < n: while i < n:
i = find_tokens(lines, [end_token, start_token], i+1) i = find_tokens(lines, [end_token, start_token], i+1)
if i == -1:
return -1
if check_token(lines[i], start_token): if check_token(lines[i], start_token):
count = count+1 count = count+1
else: else: