Skip to content

Commit 549691f

Browse files
authored
[core] proper check whether class is a TRef or TRefArray
Fixes https://its.cern.ch/jira/projects/ROOT/issues/ROOT-7052
1 parent 9f81958 commit 549691f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

core/meta/src/TStreamerElement.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "ThreadLocalStorage.h"
3131
#include "TList.h"
3232
#include "TRef.h"
33+
#include "TRefArray.h"
3334
#include "TInterpreter.h"
3435
#include "TError.h"
3536
#include "TObjArray.h"
@@ -305,8 +306,8 @@ TClass *TStreamerElement::GetClassPointer() const
305306

306307
Int_t TStreamerElement::GetExecID() const
307308
{
308-
//check if element is a TRef or TRefArray
309-
if (strncmp(fTypeName.Data(),"TRef",4) != 0) return 0;
309+
TClass* const type = GetClassPointer();
310+
if (!type || !(type->InheritsFrom(TRef::Class()) || type->InheritsFrom(TRefArray::Class()))) return 0;
310311

311312
//if the UniqueID of this element has already been set, we assume
312313
//that it contains the exec id of a TRef object.

0 commit comments

Comments
 (0)