Coverity fix: unchecked dynamic_cast
authorpolicheh <Boris.Polishchuk@cern.ch>
Sun, 11 Jan 2015 19:09:26 +0000 (22:09 +0300)
committerpolicheh <Boris.Polishchuk@cern.ch>
Sun, 11 Jan 2015 19:09:26 +0000 (22:09 +0300)
PWGGA/PHOSTasks/PHOS_PbPb/AliAnalysisTaskPi0FlowMCParamWeights.cxx

index 969bb9b..f428993 100644 (file)
@@ -49,11 +49,11 @@ void AliAnalysisTaskPi0FlowMCParamWeights::UserCreateOutputObjects()
 
       sprintf(key,"hPi0%s_cen%d", pidNames[ipid],iBin);  
       hist = dynamic_cast<TH1*>(fOutputContainer->FindObject(key));
-      hist->Sumw2(); printf("     ->Sumw2 invoked for %s.\n",key);
+      if(hist) { hist->Sumw2(); printf("     ->Sumw2 invoked for %s.\n",key); }
 
       sprintf(key,"hMiPi0%s_cen%d", pidNames[ipid],iBin);  
       hist = dynamic_cast<TH1*>(fOutputContainer->FindObject(key));
-      hist->Sumw2(); printf("     ->Sumw2 invoked for %s.\n",key);
+      if(hist) { hist->Sumw2(); printf("     ->Sumw2 invoked for %s.\n",key); }
     }
   }