2

I'm running into this error

Unhandled Fault: Alignment Exception when utilizing RapidJSON Pointers.

I've tried various things with minimal success.

rapidjson::Document jsonDoc;
rapidjson::Pointer("/levelOne/levelTwo/value").GetWithDefault(jsonDoc, "value1");
rapidjson::Document jsonDoc;
if (rapidjson::Pointer("/levelOne/levelTwo/value").Get(jsonDoc) == nullptr) {
    rapidjson::Pointer("/levelOne/levelTwo/value").GetWithDefault(jsonDoc, "value1");
}
rapidjson::Document jsonDoc;
if (rapidjson::Pointer("/levelOne/levelTwo/value").Get(jsonDoc) == nullptr) {
    rapidjson::Pointer("/levelOne/levelTwo/value").Create(jsonDoc);
    rapidjson::Pointer("/levelOne/levelTwo/value").Set(jsonDoc, "value1");
}
rapidjson::Document jsonDoc;
if (rapidjson::Pointer("/levelOne/levelTwo/value").Get(jsonDoc) == nullptr) {
    rapidjson::Pointer("/levelOne/levelTwo/value").Set(jsonDoc, "value1");
}

All of the above result in the alignment exception fault (Note: ran into the fault after Create, Set, or GetWithDefault calls. Get calls did not cause fault.). The minimal progress made was:

rapidjson::Document jsonDoc;
if (rapidjson::Pointer("/levelOne/levelTwo/value").Get(jsonDoc) == nullptr) {
    rapidjson::Pointer("/levelOne").Create(jsonDoc);
    rapidjson::Pointer("/levelOne/levelTwo").Create(jsonDoc);
    rapidjson::Pointer("/levelOne/levelTwo/value").Create(jsonDoc);
    rapidjson::Pointer("/levelOne/levelTwo/value").Set(jsonDoc, "value1");
}

The above successfully made it through the initial Create (rapidjson::Pointer("/levelOne").Create(jsonDoc)) before running into the fault.

Any feedback on where I am going wrong in using rapidjson::Pointer?

Dhia Djobbi
  • 1,176
  • 2
  • 15
  • 35
kates
  • 21
  • 2

0 Answers0