From e52b85d2671881b3043e9062a32ef32b4c995e41 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Fri, 13 Feb 2015 16:28:00 +0100 Subject: [PATCH] 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). --- lib/lyx2lyx/parser_tools.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/lyx2lyx/parser_tools.py b/lib/lyx2lyx/parser_tools.py index f5f285e666..2b6ae0570e 100644 --- a/lib/lyx2lyx/parser_tools.py +++ b/lib/lyx2lyx/parser_tools.py @@ -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 -- 2.39.5