]> git.lyx.org Git - features.git/commitdiff
Fix test to make coverity happy
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 7 Mar 2017 10:56:59 +0000 (11:56 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 7 Mar 2017 10:56:59 +0000 (11:56 +0100)
It is not obvious that cur is not null iff thisSlice is not -1, but
this is what happens in the caller.

src/mathed/MathData.cpp

index 3f298afad1ff3b0559bcd3976a5184290ab3728c..9d218987d3245e2a36513b7ddf84f2113dffc8b6 100644 (file)
@@ -781,7 +781,10 @@ void MathData::collectParameters(Cursor * cur,
                // fix cursor
                vector<CursorSlice> argSlices;
                int argPos = 0;
                // fix cursor
                vector<CursorSlice> argSlices;
                int argPos = 0;
-               if (thisSlice != -1 && thisPos == int(pos))
+               // Note: The two expressions on the first line are equivalent
+               // (see caller), but making this explicit pleases coverity.
+               if (cur && thisSlice != -1
+                       && thisPos == int(pos))
                        cur->cutOff(thisSlice, argSlices);
 
                // which kind of parameter is it? In {}? With index x^n?
                        cur->cutOff(thisSlice, argSlices);
 
                // which kind of parameter is it? In {}? With index x^n?