From 77fc67d3f01576070bb51cedc4d578c0457f5bce Mon Sep 17 00:00:00 2001 From: Scott Kostyshak Date: Wed, 6 Sep 2023 13:05:07 -0400 Subject: [PATCH] Fix lyx2lyx issue reported on ML MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The issue was reported on lyx-users by Chris Menzel [1]. Patch is from José Matos [2]. [1] https://www.mail-archive.com/search?l=mid&q=BD744D7E-54B4-4E95-A4E3-6B28F4987DE1%40gmail.com [2] https://www.mail-archive.com/search?l=mid&q=c2ac54c2322d24051f171558ad8487ea4f7078ed.camel%40gmail.com --- lib/lyx2lyx/parser_tools.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/lyx2lyx/parser_tools.py b/lib/lyx2lyx/parser_tools.py index cc2223615a..96abb1cebd 100644 --- a/lib/lyx2lyx/parser_tools.py +++ b/lib/lyx2lyx/parser_tools.py @@ -689,7 +689,8 @@ def count_pars_in_inset(lines, i): pars = 0 for j in range(ins[1], ins[2]): m = re.match(r'\\begin_layout (.*)', lines[j]) - if m and get_containing_inset(lines, j)[1] == ins[1]: + found_inset = get_containing_inset(lines, j) + if m and found_inset and found_inset[1] == ins[1]: pars += 1 return pars -- 2.39.5