diff --git a/syncd/Syncd.cpp b/syncd/Syncd.cpp index a93414caa01e..07ab90084e2d 100644 --- a/syncd/Syncd.cpp +++ b/syncd/Syncd.cpp @@ -3156,6 +3156,12 @@ void Syncd::sendShutdownRequest( { SWSS_LOG_ENTER(); + if (m_notifications == nullptr) + { + SWSS_LOG_WARN("notifications pointer is NULL"); + return; + } + auto s = sai_serialize_object_id(switchVid); SWSS_LOG_NOTICE("sending switch_shutdown_request notification to OA for switch: %s", s.c_str()); @@ -3164,11 +3170,7 @@ void Syncd::sendShutdownRequest( // TODO use m_handler->onSwitchShutdownRequest(switchVid); (but this should be per switch) - if (m_notifications == nullptr) - { - SWSS_LOG_WARN("notifications pointer is NULL"); - return; - } + s = sai_serialize_switch_shutdown_request(switchVid); m_notifications->send(SAI_SWITCH_NOTIFICATION_NAME_SWITCH_SHUTDOWN_REQUEST, s, entry); }