Skip to content
Snippets Groups Projects
Commit 6d38ac1c authored by Enrico Guiraud's avatar Enrico Guiraud
Browse files

[TTreeReader] Error out if TTreeReaderValue is reading an array

This fixes ROOT-9322
parent f2e5ecff
Branches
Tags
No related merge requests found
......@@ -537,12 +537,15 @@ const char* ROOT::Internal::TTreeReaderValueBase::GetBranchDataType(TBranch* bra
if (myLeaf){
TDictionary *myDataType = TDictionary::GetDictionary(myLeaf->GetTypeName());
if (myDataType && myDataType->IsA() == TDataType::Class()){
if (myLeaf->GetLeafCount() != nullptr || myLeaf->GetLenStatic() > 1) {
Error("TTreeReaderValueBase::GetBranchDataType()", "Must use TTreeReaderArray to read branch %s: it contains an array or a collection.", branch->GetName());
return 0;
}
dict = TDataType::GetDataType((EDataType)((TDataType*)myDataType)->GetType());
return myLeaf->GetTypeName();
}
}
// leaflist. Can't represent.
Error("TTreeReaderValueBase::GetBranchDataType()", "The branch %s was created using a leaf list and cannot be represented as a C++ type. Please access one of its siblings using a TTreeReaderArray:", branch->GetName());
TIter iLeaves(branch->GetListOfLeaves());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment