Assert index is not negative for List.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
79ab962e2f
commit
196bf5e1da
|
@ -22,7 +22,7 @@ namespace Arbutils::Collections {
|
|||
|
||||
inline const ValueT& At(size_t index) const {
|
||||
#ifndef NO_ASSERT
|
||||
if (index >= _vector.size()) {
|
||||
if (index >= _vector.size() || index < 0) {
|
||||
std::stringstream ss;
|
||||
ss << "Index " << index << " is out of bounds.";
|
||||
throw std::logic_error(ss.str());
|
||||
|
@ -32,7 +32,7 @@ namespace Arbutils::Collections {
|
|||
}
|
||||
inline ValueT& At(size_t index) {
|
||||
#ifndef NO_ASSERT
|
||||
if (index >= _vector.size()) {
|
||||
if (index >= _vector.size() || index < 0) {
|
||||
std::stringstream ss;
|
||||
ss << "Index " << index << " is out of bounds.";
|
||||
throw std::logic_error(ss.str());
|
||||
|
|
Loading…
Reference in New Issue