Skip to content
Snippets Groups Projects
Commit 70dd6a76 authored by Marco Clemencic's avatar Marco Clemencic
Browse files

Merge branch 'GAUDI-1099' into 'master'

GAUDI-1099: revert to old behaviour on bad input

See merge request !32
parents 24bc17c0 d99de2ad
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,8 @@
#include "GaudiKernel/MsgStream.h"
#include "GaudiKernel/NTuple.h"
#include "boost/optional.hpp"
#include "RDirectoryCnv.h"
// Root files
......@@ -20,6 +22,16 @@
#include "TH2.h"
#include "TH3.h"
namespace {
constexpr struct maybe_stol_t {
boost::optional<int> operator()(const std::string& s) const {
auto pos = s.find_first_of("0123456789+-");
if ( pos == std::string::npos ) return boost::none;
return std::stol( s.substr(pos) );
}
} maybe_stol {};
}
DECLARE_NAMESPACE_CONVERTER_FACTORY(RootHistCnv,RDirectoryCnv)
......@@ -84,7 +96,7 @@ RootHistCnv::RDirectoryCnv::fillObjRefs(IOpaqueAddress* pAddr,DataObject* pObj)
std::string title = obj->GetTitle();
std::string sid = obj->GetName();
std::string f2 = full + "/" + sid;
int idh = std::stol( sid.substr(sid.find_first_of("0123456789")) );
int idh = maybe_stol(sid).get_value_or(0);
// introduced by Grigori Rybkine
std::string clname = key->GetClassName();
std::string clnm = clname.substr(0,3);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment