Skip to content

CLI: stop the bare gps command crashing when no GPS was detected - #14

Open
mmmorks wants to merge 1 commit into
staging/meshcore-devfrom
pr/09c-gps-cli-crash
Open

CLI: stop the bare gps command crashing when no GPS was detected#14
mmmorks wants to merge 1 commit into
staging/meshcore-devfrom
pr/09c-gps-cli-crash

Conversation

@mmmorks

@mmmorks mmmorks commented Sep 12, 2026

Copy link
Copy Markdown
Owner

Summary

The status branch of the gps command does:

bool active = !strcmp(_sensors->getSettingByKey("gps"), "1");

getSettingByKey() returns NULL when no gps setting is registered, which is the case whenever gps_detected was false at boot — so strcmp() dereferences a null pointer and the node crashes.

Treat a missing setting as "deactivated".

Reproducing

Send gps to any node built with ENV_INCLUDE_GPS whose GPS was not detected at startup.

How it was tested

  • pio test -e native: all suites pass.
  • Compiled for meshnology_w12_repeater (ESP32-S3).

Dependencies

Independent. Applies to dev.

The status branch does strcmp(_sensors->getSettingByKey("gps"), "1").
getSettingByKey() returns NULL when no "gps" setting is registered, which is
the case whenever gps_detected was false at boot, and strcmp() then
dereferences it.

Treat a missing setting as "deactivated".
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.

1 participant