Author: rgheck
Date: Fri Nov 5 17:43:30 2010
New Revision: 36125
URL: http://www.lyx.org/trac/changeset/36125
Log:
Just a bit of safety here.
This 0 default for end is wrong. You should be able to do:
find_token(lines, token, 0, 0)
and have that return -1. As it is, this is equivalent to:
find_token(lines, token, 0, len(lines))
But I am afraid to change the default, in case something in lyx_1.2.py
relies upon it somehow.
Modified:
lyx-devel/trunk/lib/lyx2lyx/parser_tools.py
Modified: lyx-devel/trunk/lib/lyx2lyx/parser_tools.py
==============================================================================
--- lyx-devel/trunk/lib/lyx2lyx/parser_tools.py Fri Nov 5 17:33:29 2010
(r36124)
+++ lyx-devel/trunk/lib/lyx2lyx/parser_tools.py Fri Nov 5 17:43:30 2010
(r36125)
@@ -128,7 +128,7 @@
the first element, in lines[start, end].
Return -1 on failure."""
- if end == 0:
+ if end == 0 or end > len(lines):
end = len(lines)
for i in xrange(start, end):
@@ -158,7 +158,7 @@
Return -1 on failure."""
- if end == 0:
+ if end == 0 or end > len(lines):
end = len(lines)
for i in xrange(start, end):
if rexp.match(lines[i]):