From 6bd08d4ff945e52e8a01014383df6bcb3a80d434 Mon Sep 17 00:00:00 2001 From: Benedikt Volkel Date: Wed, 13 Mar 2024 11:12:01 +0100 Subject: [PATCH] [RelVal] Fix to really skip unreadable objects * e.g. missing dictionary in case of QC files that have been constructed with older SW tags --- RelVal/utils/ExtractAndFlatten.C | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/RelVal/utils/ExtractAndFlatten.C b/RelVal/utils/ExtractAndFlatten.C index 5a1ae7dde..889ed0e47 100644 --- a/RelVal/utils/ExtractAndFlatten.C +++ b/RelVal/utils/ExtractAndFlatten.C @@ -160,7 +160,7 @@ void ExtractAndFlattenDirectory(TDirectory* inDir, TDirectory* outDir, std::vect ExtractTree(tree, outDir, collectNames, basedOnTree, currentPrefix); } else { if (!WriteObject(obj, outDir, collectNames, currentPrefix)) { - std::cerr << "Cannot handle object " << obj->GetName() << " which is of class " << key->GetClassName() << "\n"; + std::cerr << "Cannot handle object of class " << key->GetClassName() << "\n"; } } } @@ -261,6 +261,10 @@ void adjustName(TObject* o) // decide which concrete function to call to write the given object bool WriteObject(TObject* o, TDirectory* outDir, std::vector& collectNames, std::string const& currentPrefix) { + if (!o) { + std::cerr << "WARNING: Cannot process object, nullptr received.\n"; + return false; + } if (auto monObj = dynamic_cast(o)) { return WriteObject(monObj->getObject(), outDir, collectNames, currentPrefix); }