diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx index 07a4e0437998..33e1d1f26aa4 100644 --- a/chart2/source/view/main/VLegend.cxx +++ b/chart2/source/view/main/VLegend.cxx @@ -446,10 +446,11 @@ awt::Size lcl_placeLegendEntries( DrawModelWrapper::removeShape( aTextShapes[nEntry] ); aTextShapes.pop_back(); } - if( nEntry < static_cast(rEntries.size()) ) + if( nEntry < nNumberOfEntries ) { DrawModelWrapper::removeShape( rEntries[ nEntry ].aSymbol ); rEntries.pop_back(); + nNumberOfEntries--; } } nSumHeight -= aRowHeights[nR];