Skip to content

Commit

Permalink
Return an empty optional in case there are no values
Browse files Browse the repository at this point in the history
Otherwise we run into a read out of bounds in case the parameter is
stored, but with an empty vector value. E.g. from setting it with a
vector that comes from an external source which is empty.
  • Loading branch information
tmadlener committed Nov 5, 2024
1 parent 8a3d387 commit f95a133
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/podio/GenericParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ std::optional<T> GenericParameters::get(const std::string& key) const {
return it->second;
} else {
const auto& iv = it->second;
if (iv.empty()) {
return std::nullopt;
}
return iv[0];
}
}
Expand Down

0 comments on commit f95a133

Please sign in to comment.