Skip to content

Commit

Permalink
check event callback before execution
Browse files Browse the repository at this point in the history
  • Loading branch information
rex-schilasky committed Nov 12, 2024
1 parent 4bccca8 commit c8caf02
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions ecal/service/ecal_service/src/client_session_impl_v0.cpp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -517,7 +517,7 @@ namespace eCAL
}
}

if (call_event_callback)
if (call_event_callback && event_callback_)
{
event_callback_(eCAL::service::ClientEventType::Disconnected, error_message);
}
Expand Down
6 changes: 3 additions & 3 deletions ecal/service/ecal_service/src/client_session_impl_v1.cpp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -644,7 +644,7 @@ namespace eCAL
}
}

if (call_event_callback)
if (call_event_callback && event_callback_)
{
event_callback_(eCAL::service::ClientEventType::Disconnected, error_message);
}
Expand Down

0 comments on commit c8caf02

Please sign in to comment.