From: hristov Date: Tue, 22 Jul 2008 10:49:35 +0000 (+0000) Subject: Additional protection in the destructor: when you have a chain of calls returning... X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=a85a36c47163a32b060cec819db8cb6cd7edb85f;ds=inline Additional protection in the destructor: when you have a chain of calls returning pointers, always check the intermediate pointers --- diff --git a/ITS/AliITSDetTypeRec.cxx b/ITS/AliITSDetTypeRec.cxx index b2016d68cc8..e217bdbd921 100644 --- a/ITS/AliITSDetTypeRec.cxx +++ b/ITS/AliITSDetTypeRec.cxx @@ -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;