Skip to content

Commit dffc9bd

Browse files
ferdymercuryguitargeek
authored andcommitted
[rootls] prevent nullptr access
Fixes #11675
1 parent 010f624 commit dffc9bd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

main/python/cmdLineUtils.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import sys
1919
from time import sleep
2020
from itertools import zip_longest
21-
21+
import cppyy
2222

2323
def fileno(file_or_fd):
2424
"""
@@ -198,6 +198,9 @@ def isDirectoryKey(key):
198198
"""
199199
classname = key.GetClassName()
200200
cl = ROOT.gROOT.GetClass(classname)
201+
if cl == cppyy.nullptr:
202+
logging.warning("Unknown class to ROOT: " + classname)
203+
return False
201204
return cl.InheritsFrom(ROOT.TDirectory.Class())
202205

203206

@@ -207,6 +210,9 @@ def isTreeKey(key):
207210
"""
208211
classname = key.GetClassName()
209212
cl = ROOT.gROOT.GetClass(classname)
213+
if cl == cppyy.nullptr:
214+
logging.warning("Unknown class to ROOT: " + classname)
215+
return False
210216
return cl.InheritsFrom(ROOT.TTree.Class())
211217

212218

@@ -216,6 +222,9 @@ def isTHnSparseKey(key):
216222
"""
217223
classname = key.GetClassName()
218224
cl = ROOT.gROOT.GetClass(classname)
225+
if cl == cppyy.nullptr:
226+
logging.warning("Unknown class to ROOT: " + classname)
227+
return False
219228
return cl.InheritsFrom(ROOT.THnSparse.Class())
220229

221230

0 commit comments

Comments
 (0)