summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2020-12-03 17:57:18 -0900
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-12-04 08:09:30 +0100
commit986952dd52861563006d0ba178e8bdd44247af81 (patch)
treea3ffb930fd3cdf867a1816b6b28484cd417f6985 /sd
parent24d770799660d3ec94ee7add435645794426042b (diff)
tdf#34828 sd navigator: fix crash when page item entry is selected
Page items in the tree are given user data value 1. Drawing obect items are given user data value of the object pointer they represent. Need to check that the user data is not 1 before casting to an object pointer. Change-Id: I58109e556268e805f62ad2f16b363411e4341d2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107185 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/dlg/sdtreelb.cxx24
1 files changed, 16 insertions, 8 deletions
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index 12ba6be2cf45..ed84546be179 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -702,15 +702,23 @@ void SdPageObjsTLV::Select()
if (m_bSelectionHandlerNavigates)
{
- SdrObject* pObject = reinterpret_cast<SdrObject*>(m_xTreeView->get_selected_id().toInt64());
- if (pObject && pObject->GetName().isEmpty())
+ // Page items in the tree are given user data value 1.
+ // Drawing object items are given user data value of the object pointer they represent.
+ sal_Int64 nUserData = m_xTreeView->get_selected_id().toInt64();
+ if (nUserData != 1)
{
- const bool bUndo = pObject->getSdrModelFromSdrObject().IsUndoEnabled();
- pObject->getSdrModelFromSdrObject().EnableUndo(false);
- pObject->SetName(m_xTreeView->get_selected_text(), false);
- m_aRowActivatedHdl.Call(*m_xTreeView);
- pObject->SetName(OUString(), false);
- pObject->getSdrModelFromSdrObject().EnableUndo(bUndo);
+ SdrObject* pObject = reinterpret_cast<SdrObject*>(nUserData);
+ if (pObject && pObject->GetName().isEmpty())
+ {
+ const bool bUndo = pObject->getSdrModelFromSdrObject().IsUndoEnabled();
+ pObject->getSdrModelFromSdrObject().EnableUndo(false);
+ pObject->SetName(m_xTreeView->get_selected_text(), false);
+ m_aRowActivatedHdl.Call(*m_xTreeView);
+ pObject->SetName(OUString(), false);
+ pObject->getSdrModelFromSdrObject().EnableUndo(bUndo);
+ }
+ else
+ m_aRowActivatedHdl.Call(*m_xTreeView);
}
else
m_aRowActivatedHdl.Call(*m_xTreeView);