Resolves: tdf#122598 avoid crash on macro recording end

Change-Id: Ie9f9fc8b4a4a7852a5da37c7d190ca020391012e
Reviewed-on: https://gerrit.libreoffice.org/66028
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara
2019-01-09 13:22:37 +00:00
parent 5135a19c0c
commit 70e7659649

View File

@@ -225,21 +225,17 @@ void MacroChooser::EnableButton(weld::Button& rButton, bool bEnable)
SbMethod* MacroChooser::GetMacro() SbMethod* MacroChooser::GetMacro()
{ {
SbMethod* pMethod = nullptr; if (!m_xBasicBox->get_cursor(m_xBasicBoxIter.get()))
m_xBasicBox->get_cursor(m_xBasicBoxIter.get()); return nullptr;
SbModule* pModule = m_xBasicBox->FindModule(m_xBasicBoxIter.get()); SbModule* pModule = m_xBasicBox->FindModule(m_xBasicBoxIter.get());
if (pModule) if (!pModule)
{ return nullptr;
if (m_xMacroBox->get_selected(m_xMacroBoxIter.get())) if (!m_xMacroBox->get_selected(m_xMacroBoxIter.get()))
{ return nullptr;
OUString aMacroName(m_xMacroBox->get_text(*m_xMacroBoxIter)); OUString aMacroName(m_xMacroBox->get_text(*m_xMacroBoxIter));
pMethod = pModule->FindMethod(aMacroName, SbxClassType::Method); return pModule->FindMethod(aMacroName, SbxClassType::Method);
}
}
return pMethod;
} }
void MacroChooser::DeleteMacro() void MacroChooser::DeleteMacro()
{ {
SbMethod* pMethod = GetMacro(); SbMethod* pMethod = GetMacro();