diff options
Diffstat (limited to 'sd/source')
-rw-r--r-- | sd/source/core/sdpage.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index 6a86108e47b2..dc6c85dc20d8 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -232,16 +232,16 @@ SdrObject* SdPage::GetPresObj(PresObjKind eObjKind, int nIndex, bool bFuzzySearc } } - if( aMatches.size() > 1 ) - { - std::sort( aMatches.begin(), aMatches.end(), OrdNumSorter() ); - } - if( nIndex > 0 ) nIndex--; if( (nIndex >= 0) && ( aMatches.size() > static_cast<unsigned int>(nIndex)) ) + { + if( aMatches.size() > 1 ) + std::nth_element( aMatches.begin(), aMatches.begin() + nIndex, aMatches.end(), + OrdNumSorter() ); return aMatches[nIndex]; + } return nullptr; } |