diff --git a/Mesh/meshGFaceDelaunayInsertion.cpp b/Mesh/meshGFaceDelaunayInsertion.cpp
index 11c4d6a6e783313379c1b9d322744ea205540718..2d79ea40227b83c24ff7fb419f21e127de9cfa1e 100644
--- a/Mesh/meshGFaceDelaunayInsertion.cpp
+++ b/Mesh/meshGFaceDelaunayInsertion.cpp
@@ -663,13 +663,18 @@ void bowyerWatson(GFace *gf)
   std::vector<SMetric3> vMetricsBGM;
 
   buildMeshGenerationDataStructures
-    (gf, AllTris, vSizes, vSizesBGM, vMetricsBGM,Us, Vs);
+    (gf, AllTris, vSizes, vSizesBGM, vMetricsBGM, Us, Vs);
 
   // _printTris ("before.pos", AllTris, Us,Vs);
   int nbSwaps = edgeSwapPass(gf, AllTris, SWCR_DEL, Us, Vs, vSizes, vSizesBGM);
   // _printTris ("after2.pos", AllTris, Us,Vs);
   Msg::Debug("Delaunization of the initial mesh done (%d swaps)", nbSwaps);
 
+  if(AllTris.empty()){
+    Msg::Error("No triangles in initial mesh");
+    return;
+  }
+
   int ITER = 0;
   while (1){
     MTri3 *worst = *AllTris.begin();
diff --git a/Numeric/DivideAndConquer.cpp b/Numeric/DivideAndConquer.cpp
index 0b19d30d291f270bf248ebebbafbfb082a89f4c3..ddc3f1c8b9794d26bec8422a1cc3e3a9f53a3e02 100644
--- a/Numeric/DivideAndConquer.cpp
+++ b/Numeric/DivideAndConquer.cpp
@@ -789,12 +789,13 @@ void DocRecord::Voronoi()
   ConvertDListToVoronoiData();
 }
 
-void DocRecord::setPoints(fullMatrix<double> *p){ 
+void DocRecord::setPoints(fullMatrix<double> *p)
+{ 
   if (numPoints != p->size1())throw;
-  for (int i=0;i<p->size1();i++){
-    x(i) = (*p)(i,0);
-    y(i) = (*p)(i,1);
-    data(i) = (*p)(i,2) < 0  ? (void *) 1 : NULL;
+  for (int i = 0; i < p->size1(); i++){
+    x(i) = (*p)(i, 0);
+    y(i) = (*p)(i, 1);
+    data(i) = (*p)(i, 2) < 0  ? (void *) 1 : NULL;
   }
 } 
 
@@ -803,7 +804,8 @@ void DocRecord::setPoints(fullMatrix<double> *p){
 void DocRecord::registerBindings(binding *b)
 {
   classBinding *cb = b->addClass<DocRecord>("Triangulator");
-  cb->setDescription("A class that does 2D delaunay triangulation (JF's SANDBOX for the moment)");
+  cb->setDescription("A class that does 2D delaunay triangulation "
+                     "(JF's SANDBOX for the moment)");
   methodBinding *cm;
 
   cm = cb->addMethod("setPoints", &DocRecord::setPoints);