commit 0f220503ff9f0b571ce3d3f8ee5941cf344edff7
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Fri Mar 10 15:54:27 2017 +0100
Small cleanup to LayoutBox and CategorizedCombo
Coverity does not find it obvious that p is never negative. Normally
it is the case (because the items have been filtered), but it is
better to play safe.
---
src/frontends/qt4/CategorizedCombo.cpp | 4 ++--
src/frontends/qt4/LayoutBox.cpp | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/frontends/qt4/CategorizedCombo.cpp
b/src/frontends/qt4/CategorizedCombo.cpp
index 8e4fc64..4509e79 100644
--- a/src/frontends/qt4/CategorizedCombo.cpp
+++ b/src/frontends/qt4/CategorizedCombo.cpp
@@ -271,10 +271,10 @@ QString CCItemDelegate::underlineFilter(QString const &
s) const
// step through data item and put "(x)" for every matching character
QString r;
int lastp = -1;
- cc_->filter();
for (int i = 0; i < f.length(); ++i) {
int p = s.indexOf(f[i], lastp + 1, Qt::CaseInsensitive);
- LASSERT(p != -1, /**/);
+ if (p < 0)
+ continue;
if (lastp == p - 1 && lastp != -1) {
// remove ")" and append "x)"
r = r.left(r.length() - 4) + s[p] + "</u>";
diff --git a/src/frontends/qt4/LayoutBox.cpp b/src/frontends/qt4/LayoutBox.cpp
index 09dd878..8945ed0 100644
--- a/src/frontends/qt4/LayoutBox.cpp
+++ b/src/frontends/qt4/LayoutBox.cpp
@@ -320,10 +320,10 @@ QString LayoutItemDelegate::underlineFilter(QString const
& s) const
// step through data item and put "(x)" for every matching character
QString r;
int lastp = -1;
- layout_->filter();
for (int i = 0; i < f.length(); ++i) {
int p = s.indexOf(f[i], lastp + 1, Qt::CaseInsensitive);
- LASSERT(p != -1, continue);
+ if (p < 0)
+ continue;
if (lastp == p - 1 && lastp != -1) {
// remove ")" and append "x)"
r = r.left(r.length() - 4) + s[p] + "</u>";