summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2017-12-14 18:52:15 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-01-05 20:24:24 +0100
commit1a27d6d76d6ef3afa5def40314120cd313b7f6d5 (patch)
tree3b69f8f838cc8e16b6977ce1125332ad971e6a5e
parentfedad0e8fd19b4a7b39476bbce7b8942ada97311 (diff)
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@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 4d4dfeac7cf8cd14efa15a2c5204afc9af4f680c) Reviewed-on: https://gerrit.libreoffice.org/46721 Tested-by: Xisco Faulí <xiscofauli@libreoffice.org>
-rw-r--r--sw/source/uibase/index/toxmgr.cxx12
1 files changed, 10 insertions, 2 deletions
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();