src/linetypes/modelobject.cpp

changeset 1367
0aab8d972cf6
parent 1326
69a90bd2dba2
child 1391
5fa4bf1fc781
--- a/src/linetypes/modelobject.cpp	Sat Mar 31 21:23:22 2018 +0300
+++ b/src/linetypes/modelobject.cpp	Sun Apr 01 11:39:07 2018 +0300
@@ -164,19 +164,24 @@
 	bool deep,
 	bool render
 ) {
-	Model inlined {context};
-	fileInfo(context)->inlineContents(inlined, deep, render);
+	LDDocument* subfile = this->fileInfo(context);
 
-	// Transform the objects
-	for (LDObject* object : inlined)
+	if (subfile != nullptr)
 	{
-		if (::shouldInvert(this, parentWinding, context))
-			::invert(object, context);
+		Model inlined {context};
+		subfile->inlineContents(inlined, deep, render);
 
-		TransformObject(object, transformationMatrix(), position(), color());
+		// Transform the objects
+		for (LDObject* object : inlined)
+		{
+			if (::shouldInvert(this, parentWinding, context))
+				::invert(object, context);
+
+			TransformObject(object, transformationMatrix(), position(), color());
+		}
+
+		model.merge(inlined);
 	}
-
-	model.merge(inlined);
 }
 
 // =============================================================================

mercurial