oss-slu / oss-slu/PilotDataSynchronization

Failed dataref lookups are transmitted as 0.0 without a guard

Open
#185 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.