PVS-StudioWarnings

PVS-Studio warning V595 for Geant4

Nov 13th, 2014
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. G4HadFinalState* G4NeutronRadCapture::ApplyYourself(
  2.   const G4HadProjectile& aTrack, G4Nucleus& theNucleus)
  3. {
  4.   ....
  5.   if (verboseLevel > 1) {
  6.     G4cout << "Gamma 4-mom: " << lv2 << "   "
  7.      << theDef->GetParticleName() << "   " << lv1 << G4endl;
  8.   }
  9.   if(theDef) {
  10.     theParticleChange.AddSecondary(
  11.       new G4DynamicParticle(theDef, lv1));
  12.   }
  13.   ....
  14. }
  15.  
  16. This suspicious code was found in Geant4 project by PVS-Studio static code analyzer.
  17. Warning message is:
  18. V595 The 'theDef' pointer was utilized before it was verified against nullptr. Check lines: 123, 125. G4hadronic_deex_photon_evaporation g4neutronradcapture.cc 123
  19.  
  20. PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment