diff options
author | Michael Stahl <mstahl@redhat.com> | 2017-12-14 18:52:15 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-12-18 13:42:55 +0100 |
commit | 4d4dfeac7cf8cd14efa15a2c5204afc9af4f680c (patch) | |
tree | d137caa3e6387e476b8c094ff99e27f1a5062f7d /sw | |
parent | ee7c13e134bfa620535714721085c1c0856a84df (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>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/index/toxmgr.cxx | 12 |
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(); |