summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2017-12-14 18:52:15 +0100
committerMichael Stahl <mstahl@redhat.com>2017-12-15 17:37:38 +0100
commit2993bb634dc9ea66af90671a55a4503843338746 (patch)
tree9983309e3c1f6e2a495eca912c9ea2dfc5359e2e
parentfa100e0abc83b876ca18b4178c44fb1dfc452a5d (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
-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();