diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-19 16:01:19 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-20 08:00:32 +0200 |
commit | 35e80e9726b5fee6a00caa58349a4b5d924dad7c (patch) | |
tree | 3f92cdee5079affdc40b73f26845d73e9a994412 /vcl | |
parent | a3143aa0dec78177e522858fbf786494c75512a0 (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 'vcl')
-rw-r--r-- | vcl/source/font/font.cxx | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx index 1cf88d394175..cd8ebb9b2a4b 100644 --- a/vcl/source/font/font.cxx +++ b/vcl/source/font/font.cxx @@ -610,9 +610,8 @@ namespace aEnt.string = pOpen+1; aEnt.string_len = (pClose-pOpen)-1; aEnt.weight = WEIGHT_NORMAL; - const int nEnt = SAL_N_ELEMENTS( weight_table ); - WeightSearchEntry const * pFound = std::lower_bound( weight_table, weight_table+nEnt, aEnt ); - if( pFound != (weight_table+nEnt) ) + WeightSearchEntry const * pFound = std::lower_bound( std::begin(weight_table), std::end(weight_table), aEnt ); + if( pFound != std::end(weight_table) && !(*pFound < aEnt)) o_rResult.SetWeight( pFound->weight ); } } |