Additional protection in the destructor: when you have a chain of calls returning...
[u/mrichter/AliRoot.git] / ITS / AliITSDetTypeRec.cxx
index b2016d68cc8f05ef4fb5fc503b6d085882fc39aa..e217bdbd921e0cdba583224240eced39a923240e 100644 (file)
@@ -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;