From: Jean-Marc Lasgouttes Date: Tue, 7 Mar 2017 10:48:32 +0000 (+0100) Subject: Fix test to make coverity happy X-Git-Tag: 2.3.0alpha1~270 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=55957c45763300229cf6084ef753d0025eebc383;p=features.git 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. --- diff --git a/src/mathed/MathData.cpp b/src/mathed/MathData.cpp index 322a8e9ceb..3f298afad1 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 x;