Skip to content

mavlink_direct: handle NaN correctly#2646

Merged
julianoes merged 1 commit intomainfrom
pr-null-not-nan
Sep 3, 2025
Merged

mavlink_direct: handle NaN correctly#2646
julianoes merged 1 commit intomainfrom
pr-null-not-nan

Conversation

@julianoes
Copy link
Copy Markdown
Collaborator

JSON doesn't support NaN, so we need to use null instead.

Also, we need to assume arrays have all the same types, and not check the type of each array field. This way we can correctly use 0 for int and null for float/double.

@julianoes
Copy link
Copy Markdown
Collaborator Author

I have to review this with fresh eyes tomorrow. I might still switch to using jsoncpp instead of this manual JSON encoding and decoding madness.

@JonasVautherin
Copy link
Copy Markdown
Collaborator

Yeah it feels like jsoncpp would make sense here 👍

@julianoes
Copy link
Copy Markdown
Collaborator Author

The problem I initially had using jsoncpp was that it doesn't let you order the fields and so the JSON output failed the test. I didn't want to have to use jsoncpp in the test as well (although maybe that would be fine?) and so Claude just came up with this manual generation.

JSON doesn't support NaN, so we need to use null instead.

Also, we need to assume arrays have all the same types, and not check
the type of each array field. This way we can correctly use 0 for int
and null for float/double.
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Sep 3, 2025

@julianoes julianoes merged commit 57e1189 into main Sep 3, 2025
54 checks passed
@julianoes julianoes deleted the pr-null-not-nan branch September 3, 2025 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants