sw/source/core/unocore/unofield.cxx |    2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 3459a691eedde416ca8ba13fc8d44ee55e8ee88f
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sun Jun 16 17:15:18 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Sun Jun 16 21:07:00 2024 +0200

    cid#1603806 Using invalid iterator
    
    Change-Id: I87d963e254607e7389429cba2839b6a318f44107
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168962
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sw/source/core/unocore/unofield.cxx 
b/sw/source/core/unocore/unofield.cxx
index f0fb208aa8cf..d3cdf7c86868 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -2951,6 +2951,8 @@ css::uno::Any SAL_CALL 
SwXTextFieldTypes::getByUniqueID(const OUString& ID)
                            [](const std::unique_ptr<SwFieldType>& pType) {
                                return pType->Which() == SwFieldIds::Postit;
                             });
+    if (fieldTypeIt == pFieldTypes->end())
+        return aRet;
     const SwFieldType & rCurType = **fieldTypeIt;
     std::vector<SwFormatField*> vFormatFields;
     rCurType.GatherFields(vFormatFields);

Reply via email to