summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/inc/authfld.hxx1
-rw-r--r--sw/source/core/fields/authfld.cxx14
2 files changed, 10 insertions, 5 deletions
diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx
index fe631d7715a0..356eddd86c39 100644
--- a/sw/inc/authfld.hxx
+++ b/sw/inc/authfld.hxx
@@ -31,6 +31,7 @@
class SwAuthEntry final : public salhelper::SimpleReferenceObject
{
+friend class SwAuthorityFieldType;
OUString aAuthFields[AUTH_FIELD_END];
public:
SwAuthEntry() = default;
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx
index 8e2ee76b2994..ecb3bc809500 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -81,18 +81,22 @@ std::unique_ptr<SwFieldType> SwAuthorityFieldType::Copy() const
return std::make_unique<SwAuthorityFieldType>(m_pDoc);
}
-void SwAuthorityFieldType::RemoveField(const SwAuthEntry* nHandle)
+void SwAuthorityFieldType::RemoveField(const SwAuthEntry* pEntry)
{
for(SwAuthDataArr::size_type j = 0; j < m_DataArr.size(); ++j)
{
- if(m_DataArr[j].get() == nHandle)
+ if(m_DataArr[j].get() == pEntry)
{
- m_DataArr.erase(m_DataArr.begin() + j);
- //re-generate positions of the fields
- DelSequenceArray();
+ if (m_DataArr[j]->m_nCount <= 1)
+ {
+ m_DataArr.erase(m_DataArr.begin() + j);
+ //re-generate positions of the fields
+ DelSequenceArray();
+ }
return;
}
}
+ assert(false);
OSL_FAIL("Field unknown" );
}