diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-01-26 14:59:30 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-01-26 21:13:58 +0100 |
commit | bbce1482f161e6e7562fad39897a04454e1c726b (patch) | |
tree | dca8a0fbe627b46c955c37e025d04e47a6418a56 /oox | |
parent | d04b4089449c0fdcaea5dcde9e8469a3ed9eedbc (diff) |
cid#1472266 silence Using invalid iterator
Change-Id: I5d332a7f0c718614ad8e07408161e214c4d9d876
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109966
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/drawingml/fillproperties.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index 597e89da8eb8..c8946c15f9a8 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -412,6 +412,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, { GradientFillProperties::GradientStopMap::const_iterator aItA( aGradientStops.begin() ); GradientFillProperties::GradientStopMap::const_iterator aItZ(std::prev(aGradientStops.end())); + assert(aItZ != aGradientStops.end()); while( bSymmetric && aItA->first < aItZ->first ) { if (!aItA->second.equals(aItZ->second, rGraphicHelper, nPhClr)) @@ -498,8 +499,11 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, { // Two segments, second is uniformly coloured SAL_INFO("oox.drawingml.gradient", "two segments, second is uniformly coloured"); - nBorder = std::prev(aGradientStops.end())->first - std::next(aGradientStops.begin())->first; - aGradientStops.erase(std::next(aGradientStops.begin())); + auto aNext = std::next(aGradientStops.begin()); + auto aPrev = std::prev(aGradientStops.end()); + assert(aPrev != aGradientStops.end()); + nBorder = aPrev->first - aNext->first; + aGradientStops.erase(aNext); aWidestSegmentStart = aGradientStops.begin(); bSwap = true; nShapeRotation = 180*60000 - nShapeRotation; |