X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=lib%2Flyx2lyx%2Fparser_tools.py;h=78459d21d9ce4afc59b7f5bee5ac35d700fc1a73;hb=f36359c7f1abd15d0ca86667ff0adfae050832ed;hp=486cfac9e1ed7739ce642a12063e5cbe899502b0;hpb=de0c8aef7c22f973319a34806482b70e459ab339;p=lyx.git diff --git a/lib/lyx2lyx/parser_tools.py b/lib/lyx2lyx/parser_tools.py index 486cfac9e1..78459d21d9 100644 --- a/lib/lyx2lyx/parser_tools.py +++ b/lib/lyx2lyx/parser_tools.py @@ -176,6 +176,8 @@ def find_beginning_of(lines, i, start_token, end_token): count = 1 while i > 0: i = find_tokens_backwards(lines, [start_token, end_token], i-1) + if i == -1: + return -1 if check_token(lines[i], end_token): count = count+1 else: @@ -190,6 +192,8 @@ def find_end_of(lines, i, start_token, end_token): n = len(lines) while i < n: i = find_tokens(lines, [end_token, start_token], i+1) + if i == -1: + return -1 if check_token(lines[i], start_token): count = count+1 else: