If yaml_emitter_dump failed, the emitter might be in a broken state and have leftover states/events.
yaml_emitter_close calls yaml_emitter_emit which will try to emit those events, so we should return early.
The recommended thing to do for library users is to abort when yaml_emitter_dump fails, but it's easy to add a check here as well.
If
yaml_emitter_dump
failed, the emitter might be in a broken state and have leftover states/events.yaml_emitter_close
callsyaml_emitter_emit
which will try to emit those events, so we should return early.The recommended thing to do for library users is to abort when
yaml_emitter_dump
fails, but it's easy to add a check here as well.