sw/source/ui/fldui/fldedt.cxx | 4 ++++ 1 file changed, 4 insertions(+)
New commits: commit d087a31fed1f8dd12bd1d3cd008cdcd2af840d07 Author: Miklos Vajna <[email protected]> AuthorDate: Tue Dec 16 14:39:18 2025 +0100 Commit: Mike Kaganski <[email protected]> CommitDate: Wed Dec 17 10:30:35 2025 +0100 sw: fix crash in SwFieldEditDlg's AddressHdl gdb in the core dump gives: #0 0x000073b5e9fd6bb9 in SwFieldType::Which (this=<optimized out>) at sw/inc/fldbas.hxx:276 #1 SwField::GetTypeId (this=0x0) at sw/source/core/fields/fldbas.cxx:267 #2 0x000073b5e911faa4 in SwFieldEditDlg::AddressHdl (this=0x4a057e70) at sw/source/ui/fldui/fldedt.cxx:296 #3 0x000073b5f85de37c in std::function<void ()>::operator()() const (this=0x7fffed028930) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/std_function.h:587 #4 Control::ImplCallEventListenersAndHandler(VclEventId, std::function<void ()> const&) (this=<optimized out>, nEvent=nEvent@entry=VclEventId::ButtonClick, callHandler=...) at vcl/source/control/ctrl.cxx:311 #5 0x000073b5f85c16c8 in Button::Click (this=<optimized out>) at vcl/source/control/button.cxx:130 and #2 0x000073b5e911faa4 in SwFieldEditDlg::AddressHdl (this=0x4a057e70) at sw/source/ui/fldui/fldedt.cxx:296 warning: Source file is more recent than executable. 296 if (pCurField->GetTypeId() == SwFieldTypesEnum::DocumentInfo) (gdb) print pCurField $2 = (SwField *) 0x0 return early in case we don't have a valid pointer for the current field anymore. Change-Id: Ibc614cc825a0b14cd4f79060d35f6635eb0cdd55 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195716 Tested-by: Caolán McNamara <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> (cherry picked from commit a46fe18c9a568ffd5f0f91048163f3478b9c7e55) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195770 Tested-by: Mike Kaganski <[email protected]> Reviewed-by: Mike Kaganski <[email protected]> diff --git a/sw/source/ui/fldui/fldedt.cxx b/sw/source/ui/fldui/fldedt.cxx index 7de2e44135e7..60dcf41b43a6 100644 --- a/sw/source/ui/fldui/fldedt.cxx +++ b/sw/source/ui/fldui/fldedt.cxx @@ -292,6 +292,10 @@ IMPL_LINK_NOARG(SwFieldEditDlg, AddressHdl, weld::Button&, void) SwFieldPage* pTabPage = static_cast<SwFieldPage*>(GetTabPage()); SwFieldMgr& rMgr = pTabPage->GetFieldMgr(); SwField *pCurField = rMgr.GetCurField(); + if (!pCurField) + { + return; + } if (pCurField->GetTypeId() == SwFieldTypesEnum::DocumentInfo) comphelper::dispatchCommand(u".uno:SetDocumentProperties"_ustr, {});
