Skip to content

Commit

Permalink
Add assert in MultivarJson::select
Browse files Browse the repository at this point in the history
  • Loading branch information
Bronek committed Oct 20, 2023
1 parent d88828b commit a738132
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ripple/json/MultivarJson.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <ripple/json/json_value.h>

#include <array>
#include <cassert>
#include <concepts>
#include <cstdlib>

Expand All @@ -37,7 +38,9 @@ struct MultivarJson
select(auto&& selector) const
requires std::same_as<std::size_t, decltype(selector())>
{
return val[selector()];
auto const index = selector();
assert(index < size);
return val[index];
}

void
Expand Down

0 comments on commit a738132

Please sign in to comment.