]> git.lyx.org Git - lyx.git/commitdiff
Fix lyx2lyx issue reported on ML
authorScott Kostyshak <skostysh@lyx.org>
Wed, 6 Sep 2023 17:05:07 +0000 (13:05 -0400)
committerScott Kostyshak <skostysh@lyx.org>
Wed, 6 Sep 2023 17:07:40 +0000 (13:07 -0400)
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

index cc2223615af07c367dbaae341005abc4ea202ece..96abb1cebd6f85f87d45e32295434c0c591f9835 100644 (file)
@@ -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