Assert index is not negative for List.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user