sw/source/filter/ww8/ww8atr.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
New commits: commit 042c2a24f598cd9405ba98342efcb00098d70b1d Author: Matteo Casalin <matteo.casa...@yahoo.com> AuthorDate: Thu Jan 31 08:14:22 2019 +0100 Commit: Matteo Casalin <matteo.casa...@yahoo.com> CommitDate: Fri Feb 8 19:34:47 2019 +0100 Replace always true condition with a more likely one indexOf is always lower than string length since "not found" is encoded as -1. Original code works correctly anyway since the "not found" case lead to copying the whole string, although this copy is completely unnecessary. Change-Id: Ic5dd995dd0c3f974c77b5bf209ad5e994b044385 Reviewed-on: https://gerrit.libreoffice.org/67320 Tested-by: Jenkins Reviewed-by: Matteo Casalin <matteo.casa...@yahoo.com> diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 07f4967a7247..02085761e3e9 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -2866,9 +2866,9 @@ void AttributeOutputBase::TextField( const SwFormatField& rField ) if (pDocInfoField != nullptr) { OUString sFieldname = pDocInfoField->GetFieldName(); - sal_Int32 nIndex = sFieldname.indexOf(':'); - if (nIndex != sFieldname.getLength()) + const sal_Int32 nIndex = sFieldname.indexOf(':'); + if (nIndex >= 0) sFieldname = sFieldname.copy(nIndex + 1); sStr = "\"" + sFieldname + "\""; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits