summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-10-19 16:01:19 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-10-20 08:00:32 +0200
commit35e80e9726b5fee6a00caa58349a4b5d924dad7c (patch)
tree3f92cdee5079affdc40b73f26845d73e9a994412 /basic
parenta3143aa0dec78177e522858fbf786494c75512a0 (diff)
when calling std::lower_bound
it's not enough to compare != end(), you also need to compare the key against the iterator result Change-Id: Ide5f151ba2297a35e5546f47fbc3c53cbe5ab533 Reviewed-on: https://gerrit.libreoffice.org/62014 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/classes/propacc.cxx13
1 files changed, 5 insertions, 8 deletions
diff --git a/basic/source/classes/propacc.cxx b/basic/source/classes/propacc.cxx
index 8cc697a76441..a14465599e0a 100644
--- a/basic/source/classes/propacc.cxx
+++ b/basic/source/classes/propacc.cxx
@@ -38,13 +38,10 @@ using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
using namespace cppu;
-struct SbCompare_UString_PropertyValue_Impl
+static bool SbCompare_UString_PropertyValue_Impl(PropertyValue const & lhs, const OUString& rhs)
{
- bool operator() (PropertyValue const & lhs, const OUString& rhs)
- {
- return lhs.Name.compareTo(rhs) < 0;
- }
-};
+ return lhs.Name.compareTo(rhs) < 0;
+}
SbPropertyValues::SbPropertyValues()
@@ -82,8 +79,8 @@ size_t SbPropertyValues::GetIndex_Impl( const OUString &rPropName ) const
{
SbPropertyValueArr_Impl::const_iterator it = std::lower_bound(
m_aPropVals.begin(), m_aPropVals.end(), rPropName,
- SbCompare_UString_PropertyValue_Impl() );
- if (it == m_aPropVals.end())
+ SbCompare_UString_PropertyValue_Impl );
+ if (it == m_aPropVals.end() || !SbCompare_UString_PropertyValue_Impl(*it, rPropName))
{
throw beans::UnknownPropertyException(
"Property not found: " + rPropName,