From bd5212e0c69f8ea23fb2f7278865c92ce9aaf7c3 Mon Sep 17 00:00:00 2001 From: Vadim Kurland Date: Mon, 6 Jun 2011 18:32:23 -0700 Subject: [PATCH] fixed crash introduced recently --- src/libgui/FWWindow_editor.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/libgui/FWWindow_editor.cpp b/src/libgui/FWWindow_editor.cpp index a017deab0..d84445427 100644 --- a/src/libgui/FWWindow_editor.cpp +++ b/src/libgui/FWWindow_editor.cpp @@ -179,6 +179,10 @@ void FWWindow::openEditor(FWObject *obj) // FWObject *parent_fw = Host::getParentHost(obj); + if (fwbdebug) + qDebug() << "parent firewall:" << parent_fw + << QString((parent_fw)? parent_fw->getName().c_str() : ""); + if (parent_fw != NULL) // this includes Cluster { RuleSetView* rsv = activeProject()->getCurrentRuleSetView(); @@ -191,18 +195,19 @@ void FWWindow::openEditor(FWObject *obj) md = (RuleSetModel*)rsv->model(); current_ruleset = md->getRuleSet(); } - if (obj != current_ruleset->getParent()) + if (parent_fw != current_ruleset->getParent()) { FWObject *old_rs = activeProject()->m_panel->om->findRuleSetInHistoryByParentFw( parent_fw); if (old_rs == NULL) - old_rs = obj->getFirstByType(Policy::TYPENAME); + old_rs = parent_fw->getFirstByType(Policy::TYPENAME); - QCoreApplication::postEvent( - activeProject(), new openRulesetImmediatelyEvent( - activeProject()->getFileName(), old_rs->getId())); + if (old_rs != NULL) + QCoreApplication::postEvent( + activeProject(), new openRulesetImmediatelyEvent( + activeProject()->getFileName(), old_rs->getId())); } } }