From 80f7c219f2bf42a1440a1598d798ea2634aeb75a Mon Sep 17 00:00:00 2001 From: Rex Schilasky <49162693+rex-schilasky@users.noreply.github.com> Date: Tue, 12 Nov 2024 16:28:32 +0100 Subject: [PATCH] [core-service] check event callback before execution (#1790) --- ecal/service/ecal_service/src/client_session_impl_v0.cpp | 6 +++--- ecal/service/ecal_service/src/client_session_impl_v1.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ecal/service/ecal_service/src/client_session_impl_v0.cpp b/ecal/service/ecal_service/src/client_session_impl_v0.cpp index da483b936c..3f8044fe98 100644 --- a/ecal/service/ecal_service/src/client_session_impl_v0.cpp +++ b/ecal/service/ecal_service/src/client_session_impl_v0.cpp @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2019 Continental Corporation + * Copyright (C) 2016 - 2024 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -229,7 +229,7 @@ namespace eCAL } // Call event callback - me->event_callback_(eCAL::service::ClientEventType::Connected, message); + if(me->event_callback_) me->event_callback_(eCAL::service::ClientEventType::Connected, message); // Start sending service requests, if there are any { @@ -517,7 +517,7 @@ namespace eCAL } } - if (call_event_callback) + if (call_event_callback && event_callback_) { event_callback_(eCAL::service::ClientEventType::Disconnected, error_message); } diff --git a/ecal/service/ecal_service/src/client_session_impl_v1.cpp b/ecal/service/ecal_service/src/client_session_impl_v1.cpp index e56d382fe7..96a6f74d43 100644 --- a/ecal/service/ecal_service/src/client_session_impl_v1.cpp +++ b/ecal/service/ecal_service/src/client_session_impl_v1.cpp @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2019 Continental Corporation + * Copyright (C) 2016 - 2024 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -325,7 +325,7 @@ namespace eCAL me->logger_(LogLevel::Info, "[" + get_connection_info_string(me->socket_) + "] " + message); // Call event callback - me->event_callback_(eCAL::service::ClientEventType::Connected, message); + if(me->event_callback_) me->event_callback_(eCAL::service::ClientEventType::Connected, message); // Start sending service requests, if there are any { @@ -644,7 +644,7 @@ namespace eCAL } } - if (call_event_callback) + if (call_event_callback && event_callback_) { event_callback_(eCAL::service::ClientEventType::Disconnected, error_message); }