]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
In AliMUONGeometryModuleTransformer, AliMUONVGeometryBuilder:
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 27 Sep 2010 16:55:27 +0000 (16:55 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 27 Sep 2010 16:55:27 +0000 (16:55 +0000)
Fixing NEGATIVE_RETURNS defects reported by Coverity

MUON/AliMUONGeometryModuleTransformer.cxx
MUON/AliMUONVGeometryBuilder.cxx

index 95aec65d2997f5aba2901472b6ffcff612fc1d9c..2f9bf0ffabee3732db4fa2e9676f068519018896 100644 (file)
@@ -190,7 +190,8 @@ TString AliMUONGeometryModuleTransformer::GetMotherVolumeName() const
   
   std::string volPath = fVolumePath.Data();
   std::string::size_type first = volPath.rfind('/');
-  volPath = volPath.substr(0, first);
+  if ( first != std::string::npos )
+    volPath = volPath.substr(0, first);
 
   std::string::size_type next = volPath.rfind('/')+1;
   std::string::size_type last = volPath.rfind('_');
index 9a4d3ddd37c439c441bcd690cb94cc91bd296785..1ae1432e36a09588617c6ff4c5c9335499d7b191 100644 (file)
@@ -447,13 +447,17 @@ void  AliMUONVGeometryBuilder::RebuildSVMaps(Bool_t withEnvelopes) const
       if ( ! withEnvelopes && geometry->IsVirtual() ) {
          std::string vName = geometry->GetTransformer()->GetVolumeName().Data();
         std::string vPath = ComposePath(vName, 1).Data();
-        path0.erase(path0.find(vPath), vPath.size());
+         std::string::size_type vPathPos = path0.find(vPath);
+         if ( vPathPos != std::string::npos )
+           path0.erase(vPathPos, vPath.size());
       }  
        
       if ( ! withEnvelopes && envelope->IsVirtual()) {
          std::string eName = envelope->GetName();
         std::string ePath = ComposePath(eName, envelope->GetCopyNo()).Data();
-        path0.erase(path0.find(ePath), ePath.size());
+         std::string::size_type ePathPos = path0.find(ePath);
+         if ( ePathPos != std::string::npos )
+           path0.erase(path0.find(ePath), ePath.size());
       }
 
       if ( ! envelope->IsVirtual() )