diff options
author | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2022-06-20 10:27:26 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2022-06-21 11:33:16 +0200 |
commit | 499ecbf3a36990c29dc7e1fb9b0ecb1d297c2848 (patch) | |
tree | 6ed02b6705a3c5023278e65858a21800d4338c6e /basctl | |
parent | 3f04d692141714259a4c4f1060213cd43804d1db (diff) |
Fix crash when no valid EntryDescriptor found
When opening macro run dlg, the last selected entry is displayed again.
When no entry was found, a crash occured in some situations
(GetLastEntryDescriptor() returned garbage).
Initialize m_aLastEntryDesc properly, and make sure the method returns
when no last selected macro was found.
Also fix some nullptr crashes which occurred during UITests
Change-Id: I7bd1a0b8824725f9935876ae26d8222410a3bc25
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136140
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/basicide/iderdll.cxx | 1 | ||||
-rw-r--r-- | basctl/source/basicide/macrodlg.cxx | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/basctl/source/basicide/iderdll.cxx b/basctl/source/basicide/iderdll.cxx index 022045050e9a..8e8a3dc3e114 100644 --- a/basctl/source/basicide/iderdll.cxx +++ b/basctl/source/basicide/iderdll.cxx @@ -145,6 +145,7 @@ ExtraData* Dll::GetExtraData () ExtraData::ExtraData () : + m_aLastEntryDesc(EntryDescriptor()), bChoosingMacro(false), bShellInCriticalSection(false) { diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx index dbeaf396f3f3..03613c96c914 100644 --- a/basctl/source/basicide/macrodlg.cxx +++ b/basctl/source/basicide/macrodlg.cxx @@ -153,6 +153,13 @@ void MacroChooser::RestoreMacroDescription() aDesc = pData->GetLastEntryDescriptor(); } + // No valid EntryDescriptor found + if (aDesc.GetMethodName().isEmpty()) + { + m_xMacroNameEdit->select_region(0, 0); + return; + } + m_xBasicBox->SetCurrentEntry(aDesc); BasicSelectHdl(m_xBasicBox->get_widget()); |