Skip to content

Commit

Permalink
Fix EvseId 0 not throwing the correct exception (#799)
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Emmers <[email protected]>
  • Loading branch information
marcemmers authored Sep 19, 2024
1 parent 0f5dfa0 commit 8124039
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/ocpp/v201/evse_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ EvseManager::EvseIterator EvseManager::end() {
}

EvseInterface& EvseManager::get_evse(int32_t id) {
if (id > this->evses.size()) {
if (id == 0 or id > this->evses.size()) {
throw EvseOutOfRangeException(id);
}
return *this->evses.at(id - 1);
}

const EvseInterface& EvseManager::get_evse(int32_t id) const {
if (id > this->evses.size()) {
if (id == 0 or id > this->evses.size()) {
throw EvseOutOfRangeException(id);
}
return *this->evses.at(id - 1);
Expand Down

0 comments on commit 8124039

Please sign in to comment.