Repository: godotengine/godot
File: scene/3d/navigation_obstacle_3d.cpp (C++)

Code before:
	map_current = p_map;
}

void NavigationObstacle3D::_update_position(const Vector3 p_position) {
	NavigationServer3D::get_singleton()->obstacle_set_position(obstacle, p_position);
}

void NavigationObstacle3D::_update_use_3d_avoidance(bool p_use_3d_avoidance) {
	NavigationServer3D::get_singleton()->obstacle_set_use_3d_avoidance(obstacle, use_3d_avoidance);
	_update_map(map_current);
}

#ifdef DEBUG_ENABLED
void NavigationObstacle3D::_update_fake_agent_radius_debug() {
	bool is_debug_enabled = false;
	if (Engine::get_singleton()->is_editor_hint()) {
		is_debug_enabled = true;
	} else if (NavigationServer3D::get_singleton()->get_debug_enabled() &&
			NavigationServer3D::get_singleton()->get_debug_avoidance_enabled() &&
			NavigationServer3D::get_singleton()->get_debug_navigation_avoidance_enable_obstacles_radius()) {
		is_debug_enabled = true;
	}

	if (is_debug_enabled == false) {
		if (fake_agent_radius_debug_instance.is_valid()) {
			RS::get_singleton()->instance_set_visible(fake_agent_radius_debug_instance, false);
		}
		return;
	}

	if (!fake_agent_radius_debug_instance.is_valid()) {
		fake_agent_radius_debug_instance = RenderingServer::get_singleton()->instance_create();
	}
	if (!fake_agent_radius_debug_mesh.is_valid()) {
		fake_agent_radius_debug_mesh = Ref<ArrayMesh>(memnew(ArrayMesh));
	}
	fake_agent_radius_debug_mesh->clear_surfaces();

	Vector<Vector3> face_vertex_array;
	Vector<int> face_indices_array;

	int i, j, prevrow, thisrow, point;
	float x, y, z;

	int rings = 16;
	int radial_segments = 32;

	point = 0;

	thisrow = 0;
	prevrow = 0;

Review comment (bug):
```suggestion
	if (fake_agent_radius_debug_mesh.is_null()) {
```

Code after:
	map_current = p_map;
}

void NavigationObstacle3D::_update_position(const Vector3 p_position) {
	NavigationServer3D::get_singleton()->obstacle_set_position(obstacle, p_position);
}

void NavigationObstacle3D::_update_use_3d_avoidance(bool p_use_3d_avoidance) {
	NavigationServer3D::get_singleton()->obstacle_set_use_3d_avoidance(obstacle, use_3d_avoidance);
	_update_map(map_current);
}

#ifdef DEBUG_ENABLED
void NavigationObstacle3D::_update_fake_agent_radius_debug() {
	bool is_debug_enabled = false;
	if (Engine::get_singleton()->is_editor_hint()) {
		is_debug_enabled = true;
	} else if (NavigationServer3D::get_singleton()->get_debug_enabled() &&
			NavigationServer3D::get_singleton()->get_debug_avoidance_enabled() &&
			NavigationServer3D::get_singleton()->get_debug_navigation_avoidance_enable_obstacles_radius()) {
		is_debug_enabled = true;
	}

	if (is_debug_enabled == false) {
		if (fake_agent_radius_debug_instance.is_valid()) {
			RS::get_singleton()->instance_set_visible(fake_agent_radius_debug_instance, false);
		}
		return;
	}

	if (!fake_agent_radius_debug_instance.is_valid()) {
		fake_agent_radius_debug_instance = RenderingServer::get_singleton()->instance_create();
	}
	if (fake_agent_radius_debug_mesh.is_null()) {
		fake_agent_radius_debug_mesh.instantiate();
	}
	fake_agent_radius_debug_mesh->clear_surfaces();

	Vector<Vector3> face_vertex_array;
	Vector<int> face_indices_array;

	int i, j, prevrow, thisrow, point;
	float x, y, z;

	int rings = 16;
	int radial_segments = 32;

	point = 0;

	thisrow = 0;
	prevrow = 0;