From 026ae756cf4ad4a4febbef58ce2f007b2a0fc974 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Mon, 13 Oct 2025 23:09:24 +0300 Subject: [PATCH] fix yaml array parsing --- src/coders/BasicParser.inl | 6 +++++- src/coders/yaml.cpp | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/coders/BasicParser.inl b/src/coders/BasicParser.inl index 7af27fe5..796205b2 100644 --- a/src/coders/BasicParser.inl +++ b/src/coders/BasicParser.inl @@ -139,8 +139,12 @@ void BasicParser::skipLine() { template void BasicParser::skipEmptyLines() { + if (!hasNext()) { + return; + } + size_t initpos = pos; skipWhitespace(); - pos = linestart; + pos = std::max(initpos, linestart); } template diff --git a/src/coders/yaml.cpp b/src/coders/yaml.cpp index 33eab3a5..f400f667 100644 --- a/src/coders/yaml.cpp +++ b/src/coders/yaml.cpp @@ -270,6 +270,10 @@ dv::value Parser::parseArray(int indent) { dv::value object = dv::object(); object[std::string(name)] = parseFullValue(next_indent); skipEmptyLines(); + if (!hasNext()) { + list.add(std::move(object)); + break; + } next_indent = countIndent(); if (next_indent > indent) { pos = linestart;