summaryrefslogtreecommitdiff
path: root/basctl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-08-16 14:02:25 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-08-16 21:31:12 +0200
commit0bafa88ce38bc9f6735d8118e544aa9232cc840c (patch)
tree34f747701a64ac6dab1697fee4265430c92854ba /basctl
parentb264c9276888bb952deeec31abe3a77e05dac164 (diff)
td#f119300 crash in Manage BreakPoints dialog
regression from commit 4b5699bff586dd923123fbfd949c9bf03e491ed7 loplugin:useuniqueptr in BreakPointList Change-Id: Ia95a1a15563b1664de938fad7c6435fc82ebf04c Reviewed-on: https://gerrit.libreoffice.org/59170 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basctl')
-rw-r--r--basctl/source/basicide/brkdlg.cxx19
-rw-r--r--basctl/source/basicide/brkdlg.hxx2
2 files changed, 13 insertions, 8 deletions
diff --git a/basctl/source/basicide/brkdlg.cxx b/basctl/source/basicide/brkdlg.cxx
index 3563e5734118..53be6215bd78 100644
--- a/basctl/source/basicide/brkdlg.cxx
+++ b/basctl/source/basicide/brkdlg.cxx
@@ -24,6 +24,7 @@
#include <basidesh.hxx>
#include <sfx2/dispatch.hxx>
+#include <vcl/lstbox.hxx>
namespace basctl
{
@@ -153,8 +154,9 @@ void BreakPointDialog::CheckButtons()
IMPL_LINK( BreakPointDialog, CheckBoxHdl, Button *, pButton, void )
{
::CheckBox * pChkBx = static_cast<::CheckBox*>(pButton);
- BreakPoint& rBrk = GetSelectedBreakPoint();
- rBrk.bEnabled = pChkBx->IsChecked();
+ BreakPoint* pBrk = GetSelectedBreakPoint();
+ if (pBrk)
+ pBrk->bEnabled = pChkBx->IsChecked();
}
IMPL_LINK( BreakPointDialog, ComboBoxHighlightHdl, ComboBox&, rBox, void )
@@ -175,8 +177,9 @@ IMPL_LINK( BreakPointDialog, EditModifyHdl, Edit&, rEdit, void )
CheckButtons();
else if (&rEdit == m_pNumericField)
{
- BreakPoint& rBrk = GetSelectedBreakPoint();
- rBrk.nStopAfter = rEdit.GetText().toInt32();
+ BreakPoint* pBrk = GetSelectedBreakPoint();
+ if (pBrk)
+ pBrk->nStopAfter = rEdit.GetText().toInt32();
}
}
@@ -234,10 +237,12 @@ void BreakPointDialog::UpdateFields( BreakPoint const & rBrk )
}
-BreakPoint& BreakPointDialog::GetSelectedBreakPoint()
+BreakPoint* BreakPointDialog::GetSelectedBreakPoint()
{
- size_t nEntry = m_pComboBox->GetEntryPos( m_pComboBox->GetText() );
- return m_aModifiedBreakPointList.at( nEntry );
+ sal_Int32 nEntry = m_pComboBox->GetEntryPos( m_pComboBox->GetText() );
+ if (nEntry == LISTBOX_ENTRY_NOTFOUND)
+ return nullptr;
+ return &m_aModifiedBreakPointList.at( nEntry );
}
} // namespace basctl
diff --git a/basctl/source/basicide/brkdlg.hxx b/basctl/source/basicide/brkdlg.hxx
index ab797a20699c..f4cd8f684f94 100644
--- a/basctl/source/basicide/brkdlg.hxx
+++ b/basctl/source/basicide/brkdlg.hxx
@@ -46,7 +46,7 @@ class BreakPointDialog final : public ModalDialog
DECL_LINK( EditModifyHdl, Edit&, void );
DECL_LINK( ButtonHdl, Button*, void );
void UpdateFields( BreakPoint const & rBrk );
- BreakPoint& GetSelectedBreakPoint();
+ BreakPoint* GetSelectedBreakPoint();
public: