Skip to content

Conversation

IamPete1
Copy link
Member

@IamPete1 IamPete1 commented Sep 2, 2025

This fixes a segfault that can happen if you try and send a MAVLink message from scripting on a channel that does not exist.

image

In this case I was trying to broadcast a message on all channels from my script. Something like:

    for i = 0, 5 do
        mavlink:send_chan(i, id, encoded)
    end

Each commit fixes the issue on its own, but I think its a good idea to have both.

@IamPete1 IamPete1 changed the title Scripting mav link segfault AP_Scripting: MAVLink: fix segfault from trying to send on invalid channel Sep 2, 2025
@magicrub
Copy link
Contributor

The gcs file changes LGTM. I'll yield to @IamPete1 on the lua change

@rmackay9
Copy link
Contributor

We agreed that @IamPete1 is free to merge after making the change that @timtuxworth has suggested regarding returning nil

@IamPete1 IamPete1 force-pushed the scriptingMAVLinkSegfault branch from e54ef23 to 6e18e10 Compare September 15, 2025 23:29
Copy link
Contributor

@tpwrules tpwrules left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@IamPete1 IamPete1 merged commit df83545 into ArduPilot:master Sep 16, 2025
107 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants