commit 3d8b02b58ea42650aa103745e5a5941e05d46a3f
Author: Juergen Spitzmueller <[email protected]>
Date:   Fri Feb 13 10:13:43 2015 +0100

    Fix bug in get_containing_inset and get_containing_layout
    
    We have to check if this is really a parent (or just the first inset/layout 
we have).
    
    Candidate for branch.

diff --git a/lib/lyx2lyx/parser_tools.py b/lib/lyx2lyx/parser_tools.py
index f1be0f0..4e30f63 100644
--- a/lib/lyx2lyx/parser_tools.py
+++ b/lib/lyx2lyx/parser_tools.py
@@ -439,6 +439,9 @@ def get_containing_inset(lines, i):
           break
       j = stins - 1
 
+  if endins < i:
+      return False
+
   inset = get_value(lines, "\\begin_inset", stins)
   if inset == "":
       # shouldn't happen
@@ -465,6 +468,9 @@ def get_containing_layout(lines, i):
           break
       j = stlay - 1
 
+  if endlay < i:
+      return False
+
   lay = get_value(lines, "\\begin_layout", stlay)
   if lay == "":
       # shouldn't happen

Reply via email to