Fix handling of "BFC INVERTNEXT" with multiple inner whitespaces

Tue, 28 Sep 2021 22:17:52 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Tue, 28 Sep 2021 22:17:52 +0300
changeset 144
5d73a6717321
parent 143
7b62c52835a1
child 145
4dea24d3eda0

Fix handling of "BFC INVERTNEXT" with multiple inner whitespaces

src/parser.cpp file | annotate | diff | comparison | revisions
--- a/src/parser.cpp	Tue Sep 28 22:14:00 2021 +0300
+++ b/src/parser.cpp	Tue Sep 28 22:17:52 2021 +0300
@@ -240,7 +240,10 @@
 		this->bag.append(this->readLine());
 	for (const QString& line : this->bag)
 	{
-		if (line == "0 BFC INVERTNEXT" or line == "0 BFC CERTIFY INVERTNEXT")
+		// Some LDraw parts such as 53588.dat can contain "BFC  INVERTNEXT" with multiple inner whitespaces.
+		// So we need to pass the string through QString::simplified to catch these cases.
+		const QString simplifiedLine = line.simplified();
+		if (simplifiedLine == "0 BFC INVERTNEXT" or simplifiedLine == "0 BFC CERTIFY INVERTNEXT")
 		{
 			invertNext = true;
 			continue;

mercurial