diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2014-07-11 13:10:43 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-07-11 09:58:55 -0700 |
commit | 966192613164622da2ae8f0770aad8a6cde508ee (patch) | |
tree | 1fc039c7c77fb228055fe5ef602b2237f86a5b05 /qt-ui/mainwindow.cpp | |
parent | 040e172d33b405fb2df75398e43eb11ff22557c6 (diff) | |
download | subsurface-966192613164622da2ae8f0770aad8a6cde508ee.tar.gz |
It's safe to delete NULL pointers
Small code cleanup, it's safe to delete null pointers.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/mainwindow.cpp')
-rw-r--r-- | qt-ui/mainwindow.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 9f4c38f70..e589344e3 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(); |