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-20 10:27:26 +0200 |
commit | 8abd6a27f0d80730596a20e8d234df9dec530571 (patch) | |
tree | 296aedc0100401907557e249c556d79209bd3a2d | |
parent | 32eec07a9e6343f87c7767b0087648fd6a8c4b58 (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.
Change-Id: I7bd1a0b8824725f9935876ae26d8222410a3bc25
-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 9f2f2dcf6315..a9ca9139a525 100644 --- a/basctl/source/basicide/iderdll.cxx +++ b/basctl/source/basicide/iderdll.cxx @@ -146,6 +146,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 0d9ee3691bcb..d6a23834c8bd 100644 --- a/basctl/source/basicide/macrodlg.cxx +++ b/basctl/source/basicide/macrodlg.cxx @@ -152,6 +152,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()); |