commit 55957c45763300229cf6084ef753d0025eebc383
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Tue Mar 7 11:48:32 2017 +0100

    Fix test to make coverity happy
    
    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 |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/mathed/MathData.cpp b/src/mathed/MathData.cpp
index 322a8e9..3f298af 100644
--- a/src/mathed/MathData.cpp
+++ b/src/mathed/MathData.cpp
@@ -739,7 +739,9 @@ void MathData::collectOptionalParameters(Cursor * cur,
                        params.push_back(optarg);
 
                // place cursor in optional argument of macro
-               if (thisSlice != -1
+               // 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) && thisPos <= int(right)) {
                        int paramPos = max(0, thisPos - int(pos) - 1);
                        vector<CursorSlice> x;

Reply via email to