Skip to content

Commit

Permalink
Additional protection in the destructor: when you have a chain of cal…
Browse files Browse the repository at this point in the history
…ls returning pointers, always check the intermediate pointers
  • Loading branch information
hristov committed Jul 22, 2008
1 parent 8161b58 commit 4dd4e81
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions ITS/AliITSDetTypeRec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,17 @@ AliITSDetTypeRec::~AliITSDetTypeRec(){
}
if(fCalibration){
if(!(AliCDBManager::Instance()->GetCacheFlag())) {
AliITSresponse* rspd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSPD()))->GetResponse();
AliITSresponse* rssd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSSD()))->GetResponse();
if(rspd) delete rspd;
if(rssd) delete rssd;
AliITSCalibration * calSPD = (AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSPD());
if (calSPD) {
AliITSresponse* rspd = calSPD->GetResponse();
if(rspd) delete rspd;
}

AliITSCalibration * calSSD = (AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSSD());
if (calSSD) {
AliITSresponse* rssd = calSSD->GetResponse();
if(rssd) delete rssd;
}
fCalibration->Delete();
delete fCalibration;
fCalibration = 0;
Expand Down

0 comments on commit 4dd4e81

Please sign in to comment.