diff --git a/DQMServices/FwkIO/plugins/DQMRootSource.cc b/DQMServices/FwkIO/plugins/DQMRootSource.cc index 9898b81e44868..0b3e6f1437dc0 100644 --- a/DQMServices/FwkIO/plugins/DQMRootSource.cc +++ b/DQMServices/FwkIO/plugins/DQMRootSource.cc @@ -550,7 +550,7 @@ std::shared_ptr DQMRootSource::readFile_() { } } //end loop over names of the file - if (!isGoodFile && m_skipBadFiles) + if (!file || (!isGoodFile && m_skipBadFiles)) continue; std::unique_ptr guid{file->Get(kCmsGuid)};