summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2019-02-09 18:34:09 +0100
committerMatteo Casalin <matteo.casalin@yahoo.com>2019-02-13 07:48:50 +0100
commit4fdc99d1b9b9da438c9a10d774951aaedf1c286a (patch)
tree043ad7eb3804a57091a182eb7945ec4026f8e555 /sfx2
parent2e0f6635d6136622a00c04ce7041969f4d7f4348 (diff)
Execute indexOf() only if needed
Change-Id: Ib018761e35841a5128a2ef1a7318ce7fac448e5c Reviewed-on: https://gerrit.libreoffice.org/67630 Tested-by: Jenkins Reviewed-by: Matteo Casalin <matteo.casalin@yahoo.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/doc/doctemplates.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index b8711f6f25cd..157539132710 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -560,9 +560,12 @@ void SfxDocTplService_Impl::getDirList()
aURL.SetURL( aDirs.getToken( 0, C_DELIM, nIdx ) );
maTemplateDirs[i] = aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE );
- sal_Int32 nIndex = maTemplateDirs[i].indexOf( aPrefix );
- if ( nIndex != -1 && xExpander.is() )
+ if ( xExpander.is() )
{
+ const sal_Int32 nIndex{ maTemplateDirs[i].indexOf( aPrefix ) };
+ if (nIndex<0)
+ continue;
+
maTemplateDirs[i] = maTemplateDirs[i].replaceAt(nIndex,
aPrefix.getLength(),
OUString());