Skip to content

Commit

Permalink
fix EvilBeaver#1419: проверка преобразования типов параметров, для пе…
Browse files Browse the repository at this point in the history
…речислений
  • Loading branch information
Mr-Rm committed Jun 20, 2024
1 parent 4552b91 commit 80959b8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/ScriptEngine/Machine/Contexts/ContextValuesMarshaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,17 @@ private static object ConvertValueType(IValue value, Type type)
}
else
{
var rawValue = value.GetRawValue();
if (rawValue is IObjectWrapper wrapped)
{
if (!type.IsInstanceOfType(wrapped.UnderlyingObject))
throw new InvalidCastException(); ;
}
else if (!type.IsInstanceOfType(rawValue))
{
throw new InvalidCastException();
}

valueObj = CastToClrObject(value);
}

Expand Down

0 comments on commit 80959b8

Please sign in to comment.