Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix FTP test segfault #1777

Merged
merged 2 commits into from
May 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/mavsdk/core/mavsdk_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,17 @@ void MavsdkImpl::receive_message(mavlink_message_t& message, Connection* connect

std::lock_guard<std::recursive_mutex> lock(_systems_mutex);

// If we have a system with sysid 0, it is the "fake" system we built to initialize the
// connection to the remote. We can remove it now that a remote system is discovered.
// The only situation where we create a system with sysid 0 is when we initialize the connection
// to the remote.
if (_systems.size() == 1 && _systems[0].first == 0) {
_systems.clear();
LogDebug() << "New: System ID: " << static_cast<int>(message.sysid)
<< " Comp ID: " << static_cast<int>(message.compid);
_systems[0].first = message.sysid;
_systems[0].second->system_impl()->set_system_id(message.sysid);

// Even though the fake system was already discovered, we can now
// send a notification, now that it seems to really actually exist.
notify_on_discover();
}

bool found_system = false;
Expand Down