coverity bug fix
authoriarsene <iarsene@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 15 Jun 2011 08:27:19 +0000 (08:27 +0000)
committeriarsene <iarsene@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 15 Jun 2011 08:27:19 +0000 (08:27 +0000)
TUHKMgen/UHKM/InitialStateHydjet.cxx

index e411c5d..d9f7bf6 100644 (file)
@@ -511,13 +511,14 @@ Bool_t InitialStateHydjet::MultIni() {
     }    
     
     if(particleDensity > 0.) {
-      //      outMult<<encoding<< "         " <<particleDensity<< "      "<<mu<<std::endl;
+      if(fParams.fNPartTypes>=kNPartTypes) {
+       Error("in Bool_t MultIni:", "fNPartTypes exceeds the maximum allowed particle species of %d. Check it out!", kNPartTypes);
+       return kFALSE;
+      }
       fParams.fPartEnc[fParams.fNPartTypes] = encoding;
       fParams.fPartMult[2 * fParams.fNPartTypes] = particleDensity;
       fParams.fPartMu[2 * fParams.fNPartTypes] = mu;
       ++fParams.fNPartTypes;
-      if(fParams.fNPartTypes > 1000)
-       Error("in Bool_t MultIni:", "fNPartTypes is too large %d", fParams.fNPartTypes);
     }
   }
   return kTRUE;