Skip to content

Commit 098cf78

Browse files
authored
fix(ocpp2): Fix crash on missing nullptr check on tx start (#1127)
There was a missing nullptr check on this->reservation when a transaction was started and reserrvation was disabled. Signed-off-by: Martin Litre <mnlitre@gmail.com>
1 parent 3c6e1be commit 098cf78

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

lib/ocpp/v2/charge_point.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ void ChargePoint::on_transaction_started(
197197
// This allows us to move from "Reserved" to "Occupied". We dont need to check if a reservation was placed since if
198198
// a transaction starts, it is always consumed and just sets the reserved flag to false and triggers a
199199
// StatusNotifcation. It does not trigger a StatusNotification when already in "Occupied"
200-
this->reservation->on_reservation_cleared(evse_id, connector_id);
200+
if (this->reservation != nullptr) {
201+
this->reservation->on_reservation_cleared(evse_id, connector_id);
202+
}
201203
this->transaction->on_transaction_started(evse_id, connector_id, session_id, timestamp, trigger_reason, meter_start,
202204
id_token, group_id_token, reservation_id, remote_start_id,
203205
charging_state);

0 commit comments

Comments
 (0)