From 2d6fa0fe9bfb3544b714519620797f74f4793151 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 21 Nov 2022 16:48:29 +0200 Subject: [PATCH] Fix reading a layout. --- src/app/puzzle/xml/vplayoutfilereader.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/app/puzzle/xml/vplayoutfilereader.cpp b/src/app/puzzle/xml/vplayoutfilereader.cpp index d3734fc4e..520599238 100644 --- a/src/app/puzzle/xml/vplayoutfilereader.cpp +++ b/src/app/puzzle/xml/vplayoutfilereader.cpp @@ -91,6 +91,11 @@ auto StringToPoint(const QString &point) -> QPointF auto StringToPath(const QString &path) -> QVector { QVector p; + if (path.isEmpty()) + { + return p; + } + QStringList points = path.split(ML::pointsSep); p.reserve(points.size()); for (const auto& point : points) @@ -528,6 +533,8 @@ VLayoutPoint VPLayoutFileReader::ReadLayoutPoint() point.SetTurnPoint(ReadAttributeBool(attribs, ML::AttrTurnPoint, falseStr)); point.SetCurvePoint(ReadAttributeBool(attribs, ML::AttrCurvePoint, falseStr)); + readElementText(); + return point; } @@ -570,9 +577,10 @@ void VPLayoutFileReader::ReadSeamAllowance(const VPPiecePtr &piece) bool builtIn = ReadAttributeBool(attribs, ML::AttrBuiltIn, falseStr); + QVector path = ReadLayoutPoints(); + if (enabled && not builtIn) { - QVector path = ReadLayoutPoints(); if (path.isEmpty()) { throw VException(tr("Error in line %1. Seam allowance is empty.").arg(lineNumber())); @@ -743,6 +751,8 @@ auto VPLayoutFileReader::ReadMarker() -> VLayoutPlaceLabel // cppcheck-suppress unknownMacro QT_WARNING_POP + readElementText(); + return marker; }