Skip to content

Commit 441a7cc

Browse files
committed
DomElement: Throw std::runtime_error if data is not XML
Sanity check to catch project files from Eagle v5 or older, which were binary and thus not supported by this parser.
1 parent 0cb416f commit 441a7cc

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

parseagle/common/domelement.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ DomElement DomElement::parse(QXmlStreamReader& reader)
5353

5454
DomElement DomElement::parse(QByteArray data)
5555
{
56+
// Sanity check that no Eagle v5 (binary) project is imported.
57+
if (!data.contains("<?xml")) {
58+
throw std::runtime_error("File does not seem to contain valid XML. "
59+
"Please note that only projects from EAGLE v6 "
60+
"or later are supported.");
61+
}
62+
5663
// Workaround for garbage in some Eagle XML files, see
5764
// https://gitlab.com/kicad/code/kicad/-/work_items/11008
5865
data.replace("\x0c", "");

0 commit comments

Comments
 (0)