From b20d68fa3213c7b8fbc39be5cf7da8a4ba355c9d Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 4 Feb 2011 16:20:15 +0100 Subject: [PATCH] Improve bat stability by checking if page valid --- bacula/src/qt-console/mainwin.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index 204d9af0b9..6984b03a35 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -442,8 +442,8 @@ void MainWin::readSettings() void MainWin::treeItemClicked(QTreeWidgetItem *item, int /*column*/) { /* Is this a page that has been inserted into the hash */ - if (getFromHash(item)) { - Pages* page = getFromHash(item); + Pages* page = getFromHash(item); + if (page) { int stackindex = tabWidget->indexOf(page); if (stackindex >= 0) { @@ -679,7 +679,9 @@ void MainWin::set_status(const char *buf) void MainWin::undockWindowButton() { Pages* page = (Pages*)tabWidget->currentWidget(); - page->togglePageDocking(); + if (page) { + page->togglePageDocking(); + } } /* @@ -694,7 +696,9 @@ void MainWin::toggleDockContextWindow() /* Is this a page that has been inserted into the hash */ if (getFromHash(currentitem)) { Pages* page = getFromHash(currentitem); - page->togglePageDocking(); + if (page) { + page->togglePageDocking(); + } } } @@ -708,7 +712,9 @@ void MainWin::stackItemChanged(int) if (m_isClosing) return; /* if closing the application, do nothing here */ Pages* page = (Pages*)tabWidget->currentWidget(); /* run the virtual function in case this class overrides it */ - page->currentStackItem(); + if (page) { + page->currentStackItem(); + } if (!m_waitState) { disconnect(treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(treeItemClicked(QTreeWidgetItem *, int))); disconnect(treeWidget, SIGNAL( currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *))); -- 2.39.5