mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 00:37:15 +01:00
Assign the parameter index temporarily before validating to prevent exception if the currently assigned index is invalid.
This commit is contained in:
parent
5136a93d37
commit
981e16ad01
@ -223,10 +223,12 @@ void Parameter::SetIndex(const Object & param)
|
||||
// We don't recognize this kind of value!
|
||||
default: STHROWF("Unknown parameter index of type (%s)", SqTypeName(param.GetType()));
|
||||
}
|
||||
// Assign the index with a failsafe to invalid on error
|
||||
AutoAssign< Int32 > aa(m_Index, 0, idx);
|
||||
// Validate the obtained parameter index
|
||||
SQMOD_VALIDATE_PARAM(*this, idx);
|
||||
// Assign the new index
|
||||
m_Index = idx;
|
||||
// Don't fall back to the invalid index anymore
|
||||
aa.Set(idx);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user