diff --git a/DataFormats/Streamer/src/StreamedProducts.cc b/DataFormats/Streamer/src/StreamedProducts.cc index f8c0f50bd39c9..e081893e3fd7f 100644 --- a/DataFormats/Streamer/src/StreamedProducts.cc +++ b/DataFormats/Streamer/src/StreamedProducts.cc @@ -9,10 +9,15 @@ namespace edm { std::vector const* parents) : desc_(&desc), present_(present), parents_(parents), prod_(const_cast(prod)), classRef_() { if(present_ && prod == 0) { - const_cast(desc).init(); + std::string branchName = desc.branchName(); + if(branchName.empty()) { + BranchDescription localCopy(desc); + localCopy.initBranchName(); + branchName = localCopy.branchName(); + } throw edm::Exception(edm::errors::LogicError, "StreamedProduct::StreamedProduct\n") << "A product with a status of 'present' is not actually present.\n" - << "The branch name is " << desc.branchName() << "\n" + << "The branch name is " << branchName << "\n" << "Contact a framework developer.\n"; } }