prevent setting invalid element numbers in the old console

This commit is contained in:
jacob1 2014-08-29 18:11:00 -04:00
parent 2140beb9cc
commit e91a7f1ec4

View File

@ -303,7 +303,7 @@ AnyType TPTScriptInterface::tptS_set(std::deque<std::string> * words)
}
else
throw GeneralException("Invalid value for assignment");
if (property.Value() == "type" && (newValue < 0 || newValue >= PT_NUM))
if (property.Value() == "type" && (newValue < 0 || newValue >= PT_NUM || !sim->elements[newValue].Enabled))
throw GeneralException("Invalid element");
if(selector.GetType() == TypePoint || selector.GetType() == TypeNumber)