diff options
| author | jacob1 <jfu614@gmail.com> | 2012-10-02 22:30:02 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-10-05 14:49:41 (GMT) |
| commit | 63c364652d58fc5b92cd9da628e6db164661ee4e (patch) | |
| tree | 80c61c001503eb7f294fee87affb83018ae484f2 /src/cat/TPTScriptInterface.cpp | |
| parent | b35fd0298c0029c17b2377550217e2cd58b4b229 (diff) | |
| download | powder-63c364652d58fc5b92cd9da628e6db164661ee4e.zip powder-63c364652d58fc5b92cd9da628e6db164661ee4e.tar.gz | |
prevent setting invalid types, fix setting type to "NONE", "C4", & "C5"
Diffstat (limited to 'src/cat/TPTScriptInterface.cpp')
| -rw-r--r-- | src/cat/TPTScriptInterface.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cat/TPTScriptInterface.cpp b/src/cat/TPTScriptInterface.cpp index 9cfba07..2f250a5 100644 --- a/src/cat/TPTScriptInterface.cpp +++ b/src/cat/TPTScriptInterface.cpp @@ -211,9 +211,15 @@ AnyType TPTScriptInterface::tptS_set(std::deque<std::string> * words) if(value.GetType() == TypeNumber) newValue = ((NumberType)value).Value(); else if(value.GetType() == TypeString) + { newValue = GetParticleType(((StringType)value).Value()); + if (newValue < 0 || newValue >= PT_NUM) + throw GeneralException("Invalid element"); + } else throw GeneralException("Invalid value for assignment"); + if (property.Value() == "type" && (newValue < 0 || newValue >= PT_NUM)) + throw GeneralException("Invalid element"); if(selector.GetType() == TypePoint || selector.GetType() == TypeNumber) { |
