Index: /issm/trunk/src/c/objects/Elements/Penta.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 7366)
+++ /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 7367)
@@ -1243,14 +1243,20 @@
 /*FUNCTION Penta::CreateKMatrixDiagnosticPattyn{{{1*/
 ElementMatrix* Penta::CreateKMatrixDiagnosticPattyn(void){
+	
+	ElementMatrix* Ke =NULL;
 
 	/*compute all stiffness matrices for this element*/
 	ElementMatrix* Ke1=CreateKMatrixDiagnosticPattynViscous();
 	ElementMatrix* Ke2=CreateKMatrixDiagnosticPattynFriction();
-	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
-
-	/*clean-up and return*/
-	delete Ke1;
-	delete Ke2;
+
+	if(Ke1 || Ke2){
+		 Ke=new ElementMatrix(Ke1,Ke2);
+
+		/*clean-up and return*/
+		delete Ke1;
+		delete Ke2;
+	}
 	return Ke;
+
 }
 /*}}}*/
@@ -1516,14 +1522,20 @@
 /*FUNCTION Penta::CreateKMatrixDiagnosticVert {{{1*/
 ElementMatrix* Penta::CreateKMatrixDiagnosticVert(void){
+	
+	ElementMatrix* Ke =NULL;
 
 	/*compute all stiffness matrices for this element*/
 	ElementMatrix* Ke1=CreateKMatrixDiagnosticVertVolume();
 	ElementMatrix* Ke2=CreateKMatrixDiagnosticVertSurface();
-	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
-
-	/*clean-up and return*/
-	delete Ke1;
-	delete Ke2;
+	
+	if(Ke1 || Ke2){
+		 Ke=new ElementMatrix(Ke1,Ke2);
+
+		/*clean-up and return*/
+		delete Ke1;
+		delete Ke2;
+	}
 	return Ke;
+
 }
 /*}}}*/
