diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-04-04 00:07:16 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-04-11 12:41:42 +0200 |
commit | 3aa89d6f3d38ce0513d8698f2ae7b23f8c6edfb9 (patch) | |
tree | 4bd8da0fe2aa804e96325e82c261a3950b4bb6e0 /src/configuration.cpp | |
parent | 9743bafd76b1ee3ceaf28c726bb94f0779e539a8 (diff) |
Fix: make no clients event works with CAN subscription
Is there is no diagnostic message corresponding then do nothing
Change-Id: Ib6627b3c10b1b7a0a46d41323a6623efe808a015
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src/configuration.cpp')
-rw-r--r-- | src/configuration.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/configuration.cpp b/src/configuration.cpp index 32cb00c..8a50cbc 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. |