You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-02 16:48:55 +00:00
Fix Navigation agent callback wild pointer crash
Fixes crash in sanitizer builds when callback agent or object are already freed.
(cherry picked from commit 194c1c44e0)
This commit is contained in:
@@ -537,14 +537,14 @@ bool GodotNavigationServer::agent_is_map_changed(RID p_agent) const {
|
||||
return agent->is_map_changed();
|
||||
}
|
||||
|
||||
COMMAND_4(agent_set_callback, RID, p_agent, Object *, p_receiver, StringName, p_method, Variant, p_udata) {
|
||||
COMMAND_4(agent_set_callback, RID, p_agent, ObjectID, p_object_id, StringName, p_method, Variant, p_udata) {
|
||||
RvoAgent *agent = agent_owner.getornull(p_agent);
|
||||
ERR_FAIL_COND(agent == nullptr);
|
||||
|
||||
agent->set_callback(p_receiver == nullptr ? 0 : p_receiver->get_instance_id(), p_method, p_udata);
|
||||
agent->set_callback(p_object_id, p_method, p_udata);
|
||||
|
||||
if (agent->get_map()) {
|
||||
if (p_receiver == nullptr) {
|
||||
if (p_object_id == ObjectID()) {
|
||||
agent->get_map()->remove_agent_as_controlled(agent);
|
||||
} else {
|
||||
agent->get_map()->set_agent_as_controlled(agent);
|
||||
|
||||
Reference in New Issue
Block a user