Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A ArduinoJson
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 24
    • Issues 24
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Benoît Blanchon
  • ArduinoJson
  • Issues
  • #1120
Closed
Open
Issue created Oct 28, 2019 by Administrator@rootContributor

Using auto type to access array nested in object crashes device

Created by: prototypicalpro

Description Running the following code snippet works great:

StaticJsonDocument<500> doc;
constexpr char str[] = "{\"contents\":[{\"module\":\"Packet\"},{\"module\":\"Analog\"}]}";
deserializeJson(doc, str);
JsonObject sensor = thing["contents"][1];
Serial.println(sensor.isNull()); // <- prints "0"

however, changing the type to auto causes my device to hang:

StaticJsonDocument<500> doc;
constexpr char str[] = "{\"contents\":[{\"module\":\"Packet\"},{\"module\":\"Analog\"}]}";
deserializeJson(doc, str);
auto sensor = thing["contents"][1];
Serial.println(sensor.isNull()); // <- Never printed, and must be reset to continue

I suspect this issue is due to ElementProxy type not resolving properly, but am unsure why this would be causing the device to crash.

Platform I am using ArduinoJson 6.12.0, Arduino IDE 1.8.10, and running this sketch on the Adafruit Feather M0 (SAMD21) with Adafruit SAMD Core 1.5.2 . I've attached the relevant sketch, as well as the build log.

Assignee
Assign to
Time tracking