Skip to content

Commit

Permalink
Merge pull request cms-sw#22961 from apana/apana-CheckForEmptyGlobalA…
Browse files Browse the repository at this point in the history
…lgBlk

Make sure the GlobalAlgBlk is not empty before accessing member data
  • Loading branch information
cmsbuild authored Apr 17, 2018
2 parents aa69072 + 3de0173 commit 546f11e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions DQM/L1TMonitor/src/L1TStage2uGTCaloLayer2Comp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,10 @@ bool L1TStage2uGTCaloLayer2Comp::compareSums(
l1t::EtSumBxCollection::const_iterator calol2It = calol2Col->begin();
l1t::EtSumBxCollection::const_iterator uGTIt = uGTCol->begin();

// if the calol2 or ugt collections have different size, mark the event as
// bad (this should never occur in normal running)
if ((calol2Col->size() != uGTCol->size())) {
// if either calol2 or ugt collections are empty, or they have different
// size, mark the event as bad (this should never occur in normal running)
if (calol2Col->size() == 0 || uGTCol->size() == 0 ||
(calol2Col->size() != uGTCol->size())) {
comparisonNum->Fill(EVENTBADSUMCOL);
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ void L1TGlobalProducer::produce(edm::Event& iEvent, const edm::EventSetup& evSet
edm::Handle<BXVector<GlobalAlgBlk>> m_uGtAlgBlk;
iEvent.getByToken(m_algoblkInputToken, m_uGtAlgBlk);

if(m_uGtAlgBlk.isValid()) {
if(m_uGtAlgBlk.isValid() && !m_uGtAlgBlk->isEmpty(0)) {
std::vector<GlobalAlgBlk>::const_iterator algBlk = m_uGtAlgBlk->begin(0);
m_prescaleSet=static_cast<unsigned int>(algBlk->getPreScColumn());
}else{
Expand Down

0 comments on commit 546f11e

Please sign in to comment.