Dont allow setting to a userdata field if it has no setter
This commit is contained in:
parent
99c91164be
commit
0763ebbad0
|
@ -84,6 +84,8 @@ namespace Porygon::UserData {
|
|||
if (!ud->ContainsField(hash.GetHash()))
|
||||
return false;
|
||||
auto field = _userData->Get()->GetField(hash.GetHash());
|
||||
if (!field->HasSetter())
|
||||
return false;
|
||||
return (val->CastableTo(field->GetType(), false) != CastResult::InvalidCast);
|
||||
|
||||
}
|
||||
|
@ -93,6 +95,8 @@ namespace Porygon::UserData {
|
|||
if (!ud->ContainsField(indexer.GetHash()))
|
||||
return false;
|
||||
auto field = _userData->Get()->GetField(indexer.GetHash());
|
||||
if (!field->HasSetter())
|
||||
return false;
|
||||
return (val->CastableTo(field->GetType(), false) != CastResult::InvalidCast);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue