diff --git a/src/libraries/JANA/JService.cc b/src/libraries/JANA/JService.cc index 0a6327fd9..60635b262 100644 --- a/src/libraries/JANA/JService.cc +++ b/src/libraries/JANA/JService.cc @@ -9,17 +9,19 @@ void JService::DoInit(JServiceLocator* sl) { std::lock_guard lock(m_mutex); if (this->m_status != Status::Uninitialized) return; - auto params = m_app->GetJParameterManager(); - m_logger = params->GetLogger(GetLoggerName()); + if (m_app != nullptr) { - for (auto* parameter : m_parameters) { - parameter->Configure(*params, m_prefix); - } + auto params = m_app->GetJParameterManager(); + m_logger = params->GetLogger(GetLoggerName()); - for (auto* service : m_services) { - service->Fetch(m_app); - } + for (auto* parameter : m_parameters) { + parameter->Configure(*params, m_prefix); + } + for (auto* service : m_services) { + service->Fetch(m_app); + } + } CallWithJExceptionWrapper("JService::acquire_services", [&](){ this->acquire_services(sl); }); CallWithJExceptionWrapper("JService::Init", [&](){ this->Init(); });