summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/configuration.cpp9
-rw-r--r--src/low-can-binding.cpp8
2 files changed, 13 insertions, 4 deletions
diff --git a/src/configuration.cpp b/src/configuration.cpp
index 32cb00cd..8a50cbc4 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -114,7 +114,9 @@ diagnostic_message_t* configuration_t::get_diagnostic_message(std::string messag
{
std::vector<diagnostic_message_t*> found;
configuration_t::instance().find_diagnostic_messages(build_DynamicField(message_name), found);
- return found.front();
+ if(! found.empty())
+ return found.front();
+ return nullptr;
}
DiagnosticRequest* configuration_t::get_request_from_diagnostic_message(diagnostic_message_t* diag_msg) const
@@ -124,7 +126,10 @@ DiagnosticRequest* configuration_t::get_request_from_diagnostic_message(diagnost
DiagnosticRequest* configuration_t::get_request_from_diagnostic_message(std::string message_name) const
{
- return new DiagnosticRequest(get_diagnostic_message(message_name)->build_diagnostic_request());
+ diagnostic_message_t* diag_msg = get_diagnostic_message(message_name);
+ if( diag_msg != nullptr)
+ return new DiagnosticRequest(diag_msg->build_diagnostic_request());
+ return nullptr;
}
/// @brief return signals name found searching through CAN signals list.
diff --git a/src/low-can-binding.cpp b/src/low-can-binding.cpp
index 8fc143c5..bcbfc2c0 100644
--- a/src/low-can-binding.cpp
+++ b/src/low-can-binding.cpp
@@ -48,8 +48,12 @@ const struct afb_binding_interface *binder_interface;
void on_no_clients(std::string message)
{
DiagnosticRequest* diag_req = configuration_t::instance().get_request_from_diagnostic_message(message);
- active_diagnostic_request_t* adr = configuration_t::instance().get_diagnostic_manager().find_recurring_request(diag_req);
- configuration_t::instance().get_diagnostic_manager().cleanup_request(adr, true);
+ if(diag_req != nullptr)
+ {
+ active_diagnostic_request_t* adr = configuration_t::instance().get_diagnostic_manager().find_recurring_request(diag_req);
+ if( adr != nullptr)
+ configuration_t::instance().get_diagnostic_manager().cleanup_request(adr, true);
+ }
}
///******************************************************************************