[Libreoffice-commits] core.git: sfx2/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Feb 13 06:49:17 UTC 2019
sfx2/source/doc/doctemplates.cxx | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
New commits:
commit 4fdc99d1b9b9da438c9a10d774951aaedf1c286a
Author: Matteo Casalin <matteo.casalin at yahoo.com>
AuthorDate: Sat Feb 9 18:34:09 2019 +0100
Commit: Matteo Casalin <matteo.casalin at yahoo.com>
CommitDate: Wed Feb 13 07:48:50 2019 +0100
Execute indexOf() only if needed
Change-Id: Ib018761e35841a5128a2ef1a7318ce7fac448e5c
Reviewed-on: https://gerrit.libreoffice.org/67630
Tested-by: Jenkins
Reviewed-by: Matteo Casalin <matteo.casalin at yahoo.com>
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());
More information about the Libreoffice-commits
mailing list