diff --git a/src/UserData/UserDataScriptType.hpp b/src/UserData/UserDataScriptType.hpp index 55651af..45cd35b 100644 --- a/src/UserData/UserDataScriptType.hpp +++ b/src/UserData/UserDataScriptType.hpp @@ -90,7 +90,7 @@ namespace Porygon::UserData { [[nodiscard]] bool CanSetIndexValue(Utilities::HashedString indexer, shared_ptr val) const override { auto ud = _userData->Get(); - if (ud->ContainsField(indexer.GetHash())) + if (!ud->ContainsField(indexer.GetHash())) return false; auto field = _userData->Get()->GetField(indexer.GetHash()); return (val->CastableTo(field->GetType(), false) != CastResult::InvalidCast);