Permalink
Browse files

it's safe to call delete on NULL. It'll just do nothing.

  • Loading branch information...
1 parent e616ee4 commit 96d9e20c6543d49810c00e51bb5c2d014abb876b @etam etam committed Jun 13, 2012
Showing with 4 additions and 8 deletions.
  1. +2 −2 background.cpp
  2. +2 −6 mainwidget.cpp
View
@@ -22,8 +22,8 @@ BackGround::BackGround(int id,QObject *parent) :
}
BackGround::~BackGround(){
- if (scene) delete scene;
- if (img) delete img;
+ delete scene;
+ delete img;
}
//Add a shape!
View
@@ -22,12 +22,8 @@ MainWidget::MainWidget(QRect geometry,QWidget *parent)
MainWidget::~MainWidget()
{
- if (levelS!=NULL){
- delete levelS;
- }
- if (level!=NULL){
- delete level;
- }
+ delete levelS;
+ delete level;
}
void MainWidget::closeEvent(QCloseEvent *e){

0 comments on commit 96d9e20

Please sign in to comment.