From e4922ebb38c06c1842c8fe7cd73f36d254c8ba81 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Fri, 11 Jul 2014 13:10:43 -0300
Subject: [PATCH] It's safe to delete NULL pointers

Small code cleanup, it's safe to delete null pointers.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 qt-ui/mainwindow.cpp | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index c221298..f60d615 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -155,8 +155,7 @@ void MainWindow::refreshDisplay(bool doRecreateDiveList)
 	WSInfoModel::instance()->updateInfo();
 	// refresh the yearly stats if the window has an instance
 	if (yearlyStats) {
-		if (yearlyStatsModel)
-			delete yearlyStatsModel;
+		delete yearlyStatsModel;
 		yearlyStatsModel = new YearlyStatisticsModel();
 		yearlyStats->setModel(yearlyStatsModel);
 	}
@@ -525,8 +524,7 @@ void MainWindow::on_actionYearlyStatistics_triggered()
 	/* problem here is that without more MainWindow variables or a separate YearlyStatistics
 	 * class the user needs to close the window/widget and re-open it for it to update.
 	 */
-	if (yearlyStatsModel)
-		delete yearlyStatsModel;
+	delete yearlyStatsModel;
 	yearlyStatsModel = new YearlyStatisticsModel();
 	yearlyStats->setModel(yearlyStatsModel);
 	yearlyStats->raise();
-- 
2.0.1

_______________________________________________
subsurface mailing list
[email protected]
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to