Skip to content

fix m_monitoringSvc and m_incidentSvc checks

Marco Clemencic requested to merge clemenci-master-patch-88979 into master

gcc11 was complaining with warnings like:

../../../Online/OnlineAlign/src/AlignDrv.cpp: In member function 'virtual StatusCode Online::AlignDrv::initialize()':
../../../Online/OnlineAlign/src/AlignDrv.cpp:101:31: warning: 'this' pointer is null [-Wnonnull]
  101 |     m_incidentSvc->addListener(this, "DAQ_PAUSE");
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~

where the actual problem is that m_incidentSvc was guaranteed to be null via:

if ( m_incidentSvc.get() ) { ...; return; }
m_incidentSvc->addListener(...);

meaning we exit if the pointer is not null.

This MR fixes the cases found by gcc, but I cannot guarantee that there are not others (like a m_incidentSvc not used immediately).

Merge request reports