From dd5feb006abff50fd99f268ef5aca91d04812bac Mon Sep 17 00:00:00 2001
From: Philippe Canal <pcanal@fnal.gov>
Date: Thu, 25 Feb 2021 14:18:00 -0600
Subject: [PATCH] TIsAProxy:  Don't record failed searches (a library might be
 loaded between now and the next search).

---
 core/meta/src/TIsAProxy.cxx | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/core/meta/src/TIsAProxy.cxx b/core/meta/src/TIsAProxy.cxx
index eb9d4ac9b51..b7a82c5d3fb 100644
--- a/core/meta/src/TIsAProxy.cxx
+++ b/core/meta/src/TIsAProxy.cxx
@@ -118,10 +118,13 @@ TClass* TIsAProxy::operator()(const void *obj)
 
    // Check if type is already in sub-class cache
    auto last = ToPair(FindSubType(typ));
-   if ( last == nullptr || last->second == nullptr )  {
+   if ( last == nullptr )  {
       // Last resort: lookup root class
       auto cls = TClass::GetClass(*typ);
-      last = ToPair(CacheSubType(typ,cls));
+      if (cls)
+         last = ToPair(CacheSubType(typ,cls));
+      else
+         return nullptr; // Don't record failed searches (a library might be loaded between now and the next search).
    }
 
    UChar_t next = fNextLastSlot++;
@@ -132,7 +135,7 @@ TClass* TIsAProxy::operator()(const void *obj)
    }
    fLasts[next].store(last);
 
-   return last == nullptr ? nullptr: last->second;
+   return last == nullptr ? nullptr : last->second;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-- 
GitLab