[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : phil
Repository : xara
Revision   : 1754
Date       : Fri Sep 15 17:01:48 BST 2006

Changed paths:
   M /Trunk/XaraLX/tools/opcntr.cpp

Fix crash when inset contour reduces paths to nothing


Diff:
Index: Trunk/XaraLX/tools/opcntr.cpp
===================================================================
--- Trunk/XaraLX/tools/opcntr.cpp	(revision 1753)
+++ Trunk/XaraLX/tools/opcntr.cpp	(revision 1754)
@@ -584,11 +584,6 @@
 			if(pChild)
 				((NodeRenderableInk *)pChild)->FindAppliedAttributes(&AttrMap);
 
-			// Create and initialize a new NodePath to hold the inset path!
-			NodePath* pNewPath;
-			ALLOC_WITH_FAIL(pNewPath, new NodePath, this);
-			pNewPath->InkPath.Initialise();
-
 			DoInvalidateNodeRegion(pContourNode,FALSE);
 
 			// Create the DoBecomeA Function and call it on the controller
@@ -603,20 +598,30 @@
 			else
 				pPathToCopy = (NodePath*)pContourNode->FindLastChild(CC_RUNTIME_CLASS(NodePath));
 
-			pNewPath->InkPath.CloneFrom(pPathToCopy->InkPath);
-
-			// now Initialize the flag array with the new Path and insert it after the group node!
-			pNewPath->InkPath.InitialiseFlags(0, pNewPath->InkPath.GetNumCoords());
-			DoInsertNewNode(pNewPath, pContourNode, NEXT, TRUE, FALSE, TRUE, TRUE);
-
-			pNewPath->InkPath.IsFilled = TRUE;
-
-			// Make sure we have the correct attributes applied to our new path and make it selected!
-			AttrMap.ApplyAttributesToNode(pNewPath);
-			pNewPath->NormaliseAttributes();
+			// pPathToCopy may be NULL if the inset contour operation reduced the input paths
+			// to nothingness...
+			if (pPathToCopy)
+			{
+				// Create and initialize a new NodePath to hold the inset path!
+				NodePath* pNewPath;
+				ALLOC_WITH_FAIL(pNewPath, new NodePath, this);
+				pNewPath->InkPath.Initialise();
+	
+				pNewPath->InkPath.CloneFrom(pPathToCopy->InkPath);
+	
+				// now Initialize the flag array with the new Path and insert it after the group node!
+				pNewPath->InkPath.InitialiseFlags(0, pNewPath->InkPath.GetNumCoords());
+				DoInsertNewNode(pNewPath, pContourNode, NEXT, TRUE, FALSE, TRUE, TRUE);
+	
+				pNewPath->InkPath.IsFilled = TRUE;
+	
+				// Make sure we have the correct attributes applied to our new path and make it selected!
+				AttrMap.ApplyAttributesToNode(pNewPath);
+				pNewPath->NormaliseAttributes();
+				
+				pNewPath->SetSelected(TRUE);
+			}
 			
-			pNewPath->SetSelected(TRUE);
-			
 			DoHideNode(pContourNode, TRUE, &pHidden, TRUE);
 //////////
 /*


Xara