Coverity
authorfprino <fprino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 29 Apr 2013 09:47:26 +0000 (09:47 +0000)
committerfprino <fprino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 29 Apr 2013 09:47:26 +0000 (09:47 +0000)
PWGHF/vertexingHF/AliAnalysisTaskSELc2V0bachelor.cxx

index c2e4a9e..598b6dd 100644 (file)
@@ -1452,10 +1452,12 @@ void AliAnalysisTaskSELc2V0bachelor::MakeAnalysisForLc2prK0S(TClonesArray *array
        AliDebug(2,Form(" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~cascade number %d (total cascade number = %d)", iLctopK0s,nCascades));
 
        AliAODMCParticle *partLc = dynamic_cast<AliAODMCParticle*>(mcArray->At(mcLabel));
-       pdgCode = partLc->GetPdgCode();
-       if (pdgCode<0) AliDebug(2,Form(" ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ MClabel=%d ~~~~~~~~~~ pdgCode=%d", mcLabel, pdgCode));
-       pdgCode = TMath::Abs(pdgCode);
-       isLc = 1;
+       if(partLc){
+         pdgCode = partLc->GetPdgCode();
+         if (pdgCode<0) AliDebug(2,Form(" ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ MClabel=%d ~~~~~~~~~~ pdgCode=%d", mcLabel, pdgCode));
+         pdgCode = TMath::Abs(pdgCode);
+         isLc = 1;
+       }
       } else {
        pdgCode=-1;
       }