[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sw/source

Michael Stahl mstahl at redhat.com
Fri Jan 5 19:24:55 UTC 2018


 sw/source/uibase/index/toxmgr.cxx |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 1a27d6d76d6ef3afa5def40314120cd313b7f6d5
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Dec 14 18:52:15 2017 +0100

    tdf#100635 sw: fix crash in SwTOXMgr::UpdateOrInsertTOX()
    
    GetAuthBrackets() returns an empty string if the user selects
    [None], in that case apparently 0 bytes are used, multiple places
    check for that.
    
    Change-Id: I8375621fa553bc780db343ed8a0bd7ecb3c832dc
    (cherry picked from commit 2993bb634dc9ea66af90671a55a4503843338746)
    Reviewed-on: https://gerrit.libreoffice.org/46568
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit 4d4dfeac7cf8cd14efa15a2c5204afc9af4f680c)
    Reviewed-on: https://gerrit.libreoffice.org/46721
    Tested-by: Xisco Faulí <xiscofauli at libreoffice.org>

diff --git a/sw/source/uibase/index/toxmgr.cxx b/sw/source/uibase/index/toxmgr.cxx
index bbd2b293628d..b5b8b31e9198 100644
--- a/sw/source/uibase/index/toxmgr.cxx
+++ b/sw/source/uibase/index/toxmgr.cxx
@@ -355,8 +355,16 @@ bool SwTOXMgr::UpdateOrInsertTOX(const SwTOXDescription& rDesc,
                     pFType = static_cast<SwAuthorityFieldType*>(
                                 pSh->InsertFieldType(type));
                 }
-                pFType->SetPreSuffix(rDesc.GetAuthBrackets()[0],
-                    rDesc.GetAuthBrackets()[1]);
+                OUString const& rBrackets(rDesc.GetAuthBrackets());
+                if (rBrackets.isEmpty())
+                {
+                    pFType->SetPreSuffix('\0', '\0');
+                }
+                else
+                {
+                    assert(rBrackets.getLength() == 2);
+                    pFType->SetPreSuffix(rBrackets[0], rBrackets[1]);
+                }
                 pFType->SetSequence(rDesc.IsAuthSequence());
                 SwTOXSortKey rArr[3];
                 rArr[0] = rDesc.GetSortKey1();


More information about the Libreoffice-commits mailing list