From 416500f3e3d7987de7c12be6fa1c239102d7f9c3 Mon Sep 17 00:00:00 2001 From: Ivan Rogach Date: Tue, 18 Feb 2025 11:48:16 +0100 Subject: [PATCH] Refuse network disconnect if the network profiles are empty Signed-off-by: Ivan Rogach --- lib/ocpp/v201/connectivity_manager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ocpp/v201/connectivity_manager.cpp b/lib/ocpp/v201/connectivity_manager.cpp index 3ce5d4040..355d2ce29 100644 --- a/lib/ocpp/v201/connectivity_manager.cpp +++ b/lib/ocpp/v201/connectivity_manager.cpp @@ -298,7 +298,10 @@ bool ConnectivityManager::send_to_websocket(const std::string& message) { } void ConnectivityManager::on_network_disconnected(OCPPInterfaceEnum ocpp_interface) { - + if (this->network_connection_slots.empty()) { + EVLOG_warning << "Network disconnected. No network connection profiles configured."; + return; + } const int actual_configuration_slot = get_active_network_configuration_slot(); std::optional network_connection_profile = this->get_network_connection_profile(actual_configuration_slot);