diff --git a/Code/DataStructs/SparseIntVect.h b/Code/DataStructs/SparseIntVect.h index 94fff594d..ae6a37605 100644 --- a/Code/DataStructs/SparseIntVect.h +++ b/Code/DataStructs/SparseIntVect.h @@ -75,7 +75,7 @@ namespace RDKit{ //! set the value at an index void setVal(IndexType idx, int val){ - if(idx>=d_length){ + if(idx<0 || idx>=d_length){ throw IndexErrorException(static_cast(idx)); } if(val!=0){