Fix off-by-one in TPTScriptInterface::tptS_set (#715)

This commit is contained in:
QuanTech0 2020-05-08 04:04:10 -04:00 committed by GitHub
parent 3fc6b38111
commit 87ee7a54e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -320,7 +320,7 @@ AnyType TPTScriptInterface::tptS_set(std::deque<String> * words)
} }
else else
partIndex = ((NumberType)selector).Value(); partIndex = ((NumberType)selector).Value();
if(partIndex<0 || partIndex>NPART || sim->parts[partIndex].type==0) if(partIndex<0 || partIndex>=NPART || sim->parts[partIndex].type==0)
throw GeneralException("Invalid particle"); throw GeneralException("Invalid particle");
switch(propertyFormat) switch(propertyFormat)