commit a6e681134a349980ff93e3ba74660cedd3b8e82f
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Thu Apr 3 15:50:53 2025 +0200

    Simplify code for InsetMathHull::addToToc
    
    This is easier to read and pleases Coverity Scan.
---
 src/mathed/InsetMathHull.cpp | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp
index de9822b285..5b1d0e57c5 100644
--- a/src/mathed/InsetMathHull.cpp
+++ b/src/mathed/InsetMathHull.cpp
@@ -326,22 +326,16 @@ void InsetMathHull::addToToc(DocIterator const & pit, 
bool output_active,
 
        // compute first and last item
        row_type first = nrows();
+       row_type last = 0;
        for (row_type row = 0; row != nrows(); ++row)
                if (numbered(row)) {
-                       first = row;
-                       break;
+                       first = min(first, row);
+                       last = max(last, row);
                }
        if (first == nrows())
                // no equation
                return;
 
-       // Reassure Coverity Scan that we have at least one row.
-       LATTEST(nrows() > 0);
-       row_type last = nrows() - 1;
-       for (; last != 0; --last)
-               if (numbered(last))
-            break;
-
        TocBuilder & b = backend.builder("equation");
         b.pushItem(pit, docstring(), output_active);
        if (first != last)
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to