mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-04-25 13:47:12 +02: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!
|
// We don't recognize this kind of value!
|
||||||
default: STHROWF("Unknown parameter index of type (%s)", SqTypeName(param.GetType()));
|
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
|
// Validate the obtained parameter index
|
||||||
SQMOD_VALIDATE_PARAM(*this, idx);
|
SQMOD_VALIDATE_PARAM(*this, idx);
|
||||||
// Assign the new index
|
// Don't fall back to the invalid index anymore
|
||||||
m_Index = idx;
|
aa.Set(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user