Assert index is not negative for List.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-03-22 18:21:29 +01:00
parent 79ab962e2f
commit 196bf5e1da
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
1 changed files with 2 additions and 2 deletions

View File

@ -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());