Skip to content

Failed dataref lookups are transmitted as 0.0 without a guard #185

Description

@Phlabry

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions