From 1e1c605bae43380b8d5ffb22a525c1d9572af48f Mon Sep 17 00:00:00 2001
From: scott snyder <sss@karma>
Date: Thu, 3 Dec 2020 11:50:26 -0500
Subject: [PATCH] MuonRegionSelector: Fix gcc 11 compilation warning.

Check the result of dynamic_cast before dereferencing.
---
 .../MuonRegionSelector/src/MuonRegSelCondAlg.cxx            | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/MuonSpectrometer/MuonDetDescr/MuonRegionSelector/src/MuonRegSelCondAlg.cxx b/MuonSpectrometer/MuonDetDescr/MuonRegionSelector/src/MuonRegSelCondAlg.cxx
index a7799acd7afc..eb1741b66b37 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonRegionSelector/src/MuonRegSelCondAlg.cxx
+++ b/MuonSpectrometer/MuonDetDescr/MuonRegionSelector/src/MuonRegSelCondAlg.cxx
@@ -77,7 +77,11 @@ StatusCode MuonRegSelCondAlg::execute(const EventContext& ctx )  const
 
   // write out new new LUT to a file if need be
   
-  if ( m_printTable ) dynamic_cast<const RegSelSiLUT*>(rd.get())->write( name()+".map" );
+  if ( m_printTable ) {
+    if (auto lut = dynamic_cast<const RegSelSiLUT*>(rd.get())) {
+      lut->write( name()+".map" );
+    }
+  }
 
   /// create the conditions data for storage 
 
-- 
GitLab