Fix stack overflow for unresolved references

This commit is contained in:
Mikhail Khachayants 2024-10-20 13:47:54 +03:00
parent fc9ddf14db
commit 1c67b948b6

View File

@ -1040,13 +1040,14 @@ private:
resolveThenPopulateSchema(rootSchema, newRootNode, referencedAdapter, subschema, {}, actualJsonPointer, resolveThenPopulateSchema(rootSchema, newRootNode, referencedAdapter, subschema, {}, actualJsonPointer,
fetchDoc, parentSchema, ownName, docCache, schemaCache); fetchDoc, parentSchema, ownName, docCache, schemaCache);
} else { } else if (!actualJsonPointer.empty()) {
const AdapterType &referencedAdapter = const AdapterType &referencedAdapter =
internal::json_pointer::resolveJsonPointer(rootNode, actualJsonPointer); internal::json_pointer::resolveJsonPointer(rootNode, actualJsonPointer);
// TODO: Need to detect degenerate circular references
resolveThenPopulateSchema(rootSchema, rootNode, referencedAdapter, subschema, {}, actualJsonPointer, resolveThenPopulateSchema(rootSchema, rootNode, referencedAdapter, subschema, {}, actualJsonPointer,
fetchDoc, parentSchema, ownName, docCache, schemaCache); fetchDoc, parentSchema, ownName, docCache, schemaCache);
} else {
throwRuntimeError("Cannot resolve reference \"" + jsonRef + "\".");
} }
} }