fix [diagram editor] : fix crash on search and replace widget

Qet crash when double click on an element/text/conductor in the tree
widget of the search and replace widget and the item is deleted from
diagram. (Call of Diagram::showme to a nullptr).
This commit is contained in:
joshua
2025-12-01 12:23:22 +01:00
parent 4e695de914
commit a9632600b6

View File

@@ -961,21 +961,21 @@ void SearchAndReplaceWidget::on_m_tree_widget_itemDoubleClicked(
else if (m_element_hash.keys().contains(item)) else if (m_element_hash.keys().contains(item))
{ {
QPointer<Element> elmt = m_element_hash.value(item); QPointer<Element> elmt = m_element_hash.value(item);
if (elmt) { if (elmt && elmt->diagram()) {
elmt.data()->diagram()->showMe(); elmt.data()->diagram()->showMe();
} }
} }
else if (m_text_hash.keys().contains(item)) else if (m_text_hash.keys().contains(item))
{ {
QPointer<IndependentTextItem> text = m_text_hash.value(item); QPointer<IndependentTextItem> text = m_text_hash.value(item);
if (text) { if (text && text->diagram()) {
text.data()->diagram()->showMe(); text.data()->diagram()->showMe();
} }
} }
else if (m_conductor_hash.keys().contains(item)) else if (m_conductor_hash.keys().contains(item))
{ {
QPointer<Conductor> cond = m_conductor_hash.value(item); QPointer<Conductor> cond = m_conductor_hash.value(item);
if (cond) { if (cond && cond->diagram()) {
cond.data()->diagram()->showMe(); cond.data()->diagram()->showMe();
} }
} }