From 84e4d85d7634e49d696e18629fe74d7004806df5 Mon Sep 17 00:00:00 2001 From: staticfox Date: Sun, 17 Apr 2016 10:29:09 -0400 Subject: LogViewWindow: Fix possible crash --- src/modules/logview/LogViewWindow.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/modules/logview/LogViewWindow.cpp') diff --git a/src/modules/logview/LogViewWindow.cpp b/src/modules/logview/LogViewWindow.cpp index f7da5e7f0..dc0c188f5 100644 --- a/src/modules/logview/LogViewWindow.cpp +++ b/src/modules/logview/LogViewWindow.cpp @@ -456,7 +456,7 @@ void LogViewWindow::rightButtonClicked(QTreeWidgetItem * pItem, const QPoint &) void LogViewWindow::deleteCurrent() { - LogListViewItem * pItem = (LogListViewItem *)(m_pListView->currentItem()); + LogListViewItem * pItem = dynamic_cast(m_pListView->currentItem()); if(!pItem) return; @@ -472,10 +472,11 @@ void LogViewWindow::deleteCurrent() return; KviFileUtils::removeFile(pItem->fileName()); - delete pItem; - m_pIrcView->clearBuffer(); if(!pItem->parent()->childCount()) delete pItem->parent(); + + delete pItem; + m_pIrcView->clearBuffer(); } return; } -- cgit v1.3.1-10-gc9f91