From c4a33eb0e0a19d6859d4ce3c0174ed5ce4e4a7fb Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 14 Jun 2015 12:48:12 +0000 Subject: [PATCH] removed false positive access beyond range of iterator git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8436 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/common/RSGraphWidget.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/retroshare-gui/src/gui/common/RSGraphWidget.cpp b/retroshare-gui/src/gui/common/RSGraphWidget.cpp index deea1a2e7..f0d0828ec 100644 --- a/retroshare-gui/src/gui/common/RSGraphWidget.cpp +++ b/retroshare-gui/src/gui/common/RSGraphWidget.cpp @@ -86,18 +86,12 @@ int RSGraphSource::n_values() const { return _points.size() ; } QString RSGraphSource::displayName(int i) const { - if(_points.empty()) - return QString() ; - - std::map > >::const_iterator it = _points.begin(); - int n=0; - for(it = _points.begin();it!=_points.end() && n > >::const_iterator it = _points.begin();it!=_points.end() ;++it) + if(n++ == i) + return QString::fromStdString(it->first) ; - if(n != i) - return QString("[error]"); - - return QString::fromStdString(it->first) ; + return QString("[error]"); } QString RSGraphSource::displayValue(float v) const