From 94805f626778766242d460db802e85bb818d69da Mon Sep 17 00:00:00 2001
From: scott snyder <sss@karma>
Date: Mon, 7 Dec 2020 16:59:15 -0500
Subject: [PATCH] METUtilities: Fix gcc11 warning.

Check result of dynamic_cast before dereferencing.
---
 Reconstruction/MET/METUtilities/Root/METSignificance.cxx | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Reconstruction/MET/METUtilities/Root/METSignificance.cxx b/Reconstruction/MET/METUtilities/Root/METSignificance.cxx
index e1a0fce43eb..21e5558d751 100644
--- a/Reconstruction/MET/METUtilities/Root/METSignificance.cxx
+++ b/Reconstruction/MET/METUtilities/Root/METSignificance.cxx
@@ -562,7 +562,9 @@ namespace met {
     }
     else{
       const xAOD::TauJet* tau(static_cast<const xAOD::TauJet*>(obj));
-      pt_reso = dynamic_cast<CombinedP4FromRecoTaus*>(m_tCombinedP4FromRecoTaus.get())->getCaloResolution(*tau);
+      if (auto combp4 = dynamic_cast<CombinedP4FromRecoTaus*>(m_tCombinedP4FromRecoTaus.get())) {
+        pt_reso = combp4->getCaloResolution(*tau);
+      }
       
       if(m_doPhiReso) phi_reso = tau->pt()*0.01;
       ATH_MSG_VERBOSE("tau: " << pt_reso << " " << tau->pt() << " " << tau->p4().Eta() << " " << tau->p4().Phi() << " phi reso: " << phi_reso);
-- 
GitLab