@@ 1924,11 1924,6 @@ static cyaml_err_t cyaml__read_value(
cyaml__type_to_str(schema->type),
schema->flags & CYAML_FLAG_POINTER ? " (pointer)" : "");
- err = cyaml__validate_event_type_for_schema(ctx, schema, event);
- if (err != CYAML_OK) {
- return err;
- }
-
if (cyaml_event == CYAML_EVT_SCALAR) {
if (cyaml__string_is_null_ptr(schema,
(const char *)event->data.scalar.value)) {
@@ 1938,6 1933,11 @@ static cyaml_err_t cyaml__read_value(
}
}
+ err = cyaml__validate_event_type_for_schema(ctx, schema, event);
+ if (err != CYAML_OK) {
+ return err;
+ }
+
if (cyaml__is_sequence(schema) == false) {
/* Since sequences extend their allocation for each entry,
* they're handled in the sequence-specific code.