Fixed issue where attempting setting to a non existing field on userdata would crash.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
8c13c2c84c
commit
99c91164be
|
@ -90,7 +90,7 @@ namespace Porygon::UserData {
|
||||||
|
|
||||||
[[nodiscard]] bool CanSetIndexValue(Utilities::HashedString indexer, shared_ptr<const ScriptType> val) const override {
|
[[nodiscard]] bool CanSetIndexValue(Utilities::HashedString indexer, shared_ptr<const ScriptType> val) const override {
|
||||||
auto ud = _userData->Get();
|
auto ud = _userData->Get();
|
||||||
if (ud->ContainsField(indexer.GetHash()))
|
if (!ud->ContainsField(indexer.GetHash()))
|
||||||
return false;
|
return false;
|
||||||
auto field = _userData->Get()->GetField(indexer.GetHash());
|
auto field = _userData->Get()->GetField(indexer.GetHash());
|
||||||
return (val->CastableTo(field->GetType(), false) != CastResult::InvalidCast);
|
return (val->CastableTo(field->GetType(), false) != CastResult::InvalidCast);
|
||||||
|
|
Loading…
Reference in New Issue