oss-slu / oss-slu/PilotDataSynchronization
Failed dataref lookups are transmitted as 0.0 without a guard
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 4
- Forks
- 8
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 2
Description
Describe the bug
If XPLMFindDataRef fails it returns NULL, and XPLMGetDataf then returns 0.0 (XPLMDataAccess.h:342-344: "the dataref value or 0.0 if the dataref is NULL or the plugin is disabled"). The eight-value vector is built and sent with no validity check between construction and baton->send (xplane_plugin/src/pilotdatasync-xp11.cpp:423-440), so a failed lookup transmits 0.0. That is indistinguishable from a real zero reading, and downstream an altitude of 0 is labeled TAXI.
Expected behavior
DataRef handles are checked for NULL after lookup, and values from a failed lookup are not transmitted, or are sent as something iMotions and the logger can recognize as missing.
Additional context
The plugin checks std::isnan for display (xplane_plugin/src/pilotdatasync-xp11.cpp:267-271), but a failed read never produces NaN, so that check never triggers. The same gap exists on the button path at :144-150. This appears to be an unfinished part of #63.
Found while writing the setup documentation in #138 / #178.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in xplane_plugin/src/pilotdatasync-xp11.cpp at lines 423-440 and trace the dataref lookup, eight-value vector construction, and baton->send call. Also inspect the button path at lines 144-150 and the display NaN check at lines 267-271. Done means failed lookups are guarded and their values are not transmitted as indistinguishable 0.0 readings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 66/100