Skip to content

Commit

Permalink
Merge pull request #2716 from wmtan/AvoidPlaybackSegfaultOnEmptyFileList
Browse files Browse the repository at this point in the history
Misc fixes -- Avoid segfault in playback mode if no files specified
  • Loading branch information
ktf committed Mar 4, 2014
2 parents c59a576 + 3ba71d9 commit b55b567
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions IOPool/Input/src/RootInputFileSequence.cc
Expand Up @@ -631,7 +631,7 @@ namespace edm {
skipBadFiles_ = false;
if(fileIter_ == fileIterEnd_ || !rootFile_) {
if(fileIterEnd_ == fileIterBegin_) {
throw Exception(errors::Configuration) << "RootInputFileSequence::readOneSequential(): no input files specified.\n";
throw Exception(errors::Configuration) << "RootInputFileSequence::readOneSequential(): no input files specified for secondary input source.\n";
}
fileIter_ = fileIterBegin_;
initFile(false);
Expand All @@ -657,7 +657,7 @@ namespace edm {
bool
RootInputFileSequence::readOneSequentialWithID(EventPrincipal& cache, LuminosityBlockID const& id) {
if(fileIterEnd_ == fileIterBegin_) {
throw Exception(errors::Configuration) << "RootInputFileSequence::readOneSequentialWithID(): no input files specified.\n";
throw Exception(errors::Configuration) << "RootInputFileSequence::readOneSequentialWithID(): no input files specified for secondary input source.\n";
}
skipBadFiles_ = false;
if(fileIter_ == fileIterEnd_ || !rootFile_ ||
Expand Down Expand Up @@ -685,13 +685,15 @@ namespace edm {

void
RootInputFileSequence::readOneSpecified(EventPrincipal& cache, EventID const& id) {
if(fileIterEnd_ == fileIterBegin_) {
throw Exception(errors::Configuration) << "RootInputFileSequence::readOneSpecified(): no input files specified for secondary input source.\n";
}
skipBadFiles_ = false;
bool found = skipToItem(id.run(), id.luminosityBlock(), id.event());
if(!found) {
throw Exception(errors::NotFound) <<
"RootInputFileSequence::readOneSpecified(): Secondary Input file " <<
fileIter_->fileName() <<
" does not contain specified event:\n" << id << "\n";
throw Exception(errors::NotFound) <<
"RootInputFileSequence::readOneSpecified(): Secondary Input files" <<
" do not contain specified event:\n" << id << "\n";
}
assert(rootFile_);
found = rootFile_->readCurrentEvent(cache);
Expand All @@ -701,7 +703,7 @@ namespace edm {
void
RootInputFileSequence::readOneRandom(EventPrincipal& cache, CLHEP::HepRandomEngine* engine) {
if(fileIterEnd_ == fileIterBegin_) {
throw Exception(errors::Configuration) << "RootInputFileSequence::readOneRandom(): no input files specified.\n";
throw Exception(errors::Configuration) << "RootInputFileSequence::readOneRandom(): no input files specified for secondary input source.\n";
}
assert(rootFile_);
skipBadFiles_ = false;
Expand Down Expand Up @@ -737,7 +739,7 @@ namespace edm {
bool
RootInputFileSequence::readOneRandomWithID(EventPrincipal& cache, LuminosityBlockID const& id, CLHEP::HepRandomEngine* engine) {
if(fileIterEnd_ == fileIterBegin_) {
throw Exception(errors::Configuration) << "RootInputFileSequence::readOneRandomWithID(): no input files specified.\n";
throw Exception(errors::Configuration) << "RootInputFileSequence::readOneRandomWithID(): no input files specified for secondary input source.\n";
}
skipBadFiles_ = false;
if(fileIter_ == fileIterEnd_ || !rootFile_ ||
Expand Down

0 comments on commit b55b567

Please sign in to comment.