]> git.lyx.org Git - features.git/commitdiff
Fix bug in get_containing_inset and get_containing_layout
authorJuergen Spitzmueller <spitz@lyx.org>
Fri, 13 Feb 2015 15:28:00 +0000 (16:28 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Fri, 13 Feb 2015 15:28:00 +0000 (16:28 +0100)
We have to check if this is really a parent (or just the first inset/layout we have).

lib/lyx2lyx/parser_tools.py

index f5f285e6660a2a6c880449259f8b278c0ae35fdc..2b6ae0570e7ae04c1e1e81b5264c105093fab93e 100644 (file)
@@ -438,7 +438,10 @@ def get_containing_inset(lines, i):
       if endins > j:
           break
       j = stins - 1
-  
+
+  if endins < i:
+      return False
+
   inset = get_value(lines, "\\begin_inset", stins)
   if inset == "":
       # shouldn't happen
@@ -464,7 +467,10 @@ def get_containing_layout(lines, i):
       if endlay > i:
           break
       j = stlay - 1
-  
+
+  if endlay < i:
+      return False
+
   lay = get_value(lines, "\\begin_layout", stlay)
   if lay == "":
       # shouldn't happen