fix(gdscript): Fix out of bounds crash after reloading member variables
The crash happens because the members Vector is resized, while the member_indices_cache still has the old indices saved. On deleting a member from the script this can result to a cached index of 1 while the members Vector size is only 1.
This commit is contained in:
parent
c4d7a5d22a
commit
e03b7b1935
@ -1636,8 +1636,6 @@ const Vector<Multiplayer::RPCConfig> GDScriptInstance::get_rpc_methods() const {
|
||||
void GDScriptInstance::reload_members() {
|
||||
#ifdef DEBUG_ENABLED
|
||||
|
||||
members.resize(script->member_indices.size()); //resize
|
||||
|
||||
Vector<Variant> new_members;
|
||||
new_members.resize(script->member_indices.size());
|
||||
|
||||
@ -1649,6 +1647,8 @@ void GDScriptInstance::reload_members() {
|
||||
}
|
||||
}
|
||||
|
||||
members.resize(new_members.size()); //resize
|
||||
|
||||
//apply
|
||||
members = new_members;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user