Index: src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_shape.cpp
===================================================================
--- src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_shape.cpp	(revision 27888fd60fedb9daf1311f4503c4ecb04ae30759)
+++ src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_shape.cpp	(revision 7f1b51d9ebdfbd81ece2b0afc41b3153a06c5e91)
@@ -80,49 +80,52 @@
   std::vector<Vector> points = shape.getHomogeneousPointsOnSurface(NumPointsonSurface);
 
-  // Fill the points into a tesselate-able container.
-  TesselPointSTLList Corners;
-  for (size_t i=0;i<points.size();++i){
-    TesselPoint *Walker = new TesselPoint;
-    Walker->setPosition(points[i]);
-    Walker->setName(toString(i));
-    Walker->setNr(i);
-    Corners.push_back(Walker);
-  }
-
-  // Tesselate the points.
-  Tesselation *T = new Tesselation;
-  PointCloudAdaptor<TesselPointSTLList> cloud(&Corners, "TesselPointSTLList");
-  (*T)(cloud, minradius);
-
-  // Fill the points into a Qt geometry.
   QGeometryData geo;
-  LinkedCell_deprecated LinkedList(cloud, minradius);
-  std::vector<Vector> normals;
-  normals.resize(points.size(), zeroVec);
-  for(size_t i=0;i<points.size();++i){
-    // add data to the primitive
-    geo.appendVertex(QVector3D(points[i][0], points[i][1], points[i][2]));
-    if (ShapeFactory::getInstance().isSimpleShape(shape.getType()))
-      normals[i] = shape.getNormal(points[i]);
-    else
-      normals[i] = T->getNormal(points[i], &LinkedList);
-    geo.appendNormal(QVector3D(normals[i][0], normals[i][1], normals[i][2]));
-    geo.appendColor(QColor(1, 1, 1, 1));
-    geo.appendTexCoord(QVector2D(0, 0));
-  }
-
-  // Fill the tesselated triangles into the geometry.
-  for (TriangleMap::const_iterator runner = T->TrianglesOnBoundary.begin(); runner != T->TrianglesOnBoundary.end(); runner++) {
-    int v[3];
-    for (size_t i=0; i<3; ++i)
-      v[i] = runner->second->endpoints[i]->node->getNr();
-
-    // Sort the vertices so the triangle is clockwise (relative to the normal vector).
-    Vector cross = points[v[1]] - points[v[0]];
-    cross.VectorProduct(points[v[2]] - points[v[0]]);
-    if (cross.ScalarProduct(normals[v[0]] + normals[v[1]] + normals[v[2]]) > 0)
-      geo.appendIndices(v[0], v[1], v[2]);
-    else
-      geo.appendIndices(v[0], v[2], v[1]);
+  // we need at least three points for tesselation
+  if (points.size() >= 3) {
+    // Fill the points into a tesselate-able container.
+    TesselPointSTLList Corners;
+    for (size_t i=0;i<points.size();++i){
+      TesselPoint *Walker = new TesselPoint;
+      Walker->setPosition(points[i]);
+      Walker->setName(toString(i));
+      Walker->setNr(i);
+      Corners.push_back(Walker);
+    }
+  
+    // Tesselate the points.
+    Tesselation T;
+    PointCloudAdaptor<TesselPointSTLList> cloud(&Corners, "TesselPointSTLList");
+    T(cloud, minradius);
+  
+    // Fill the points into a Qt geometry.
+    LinkedCell_deprecated LinkedList(cloud, minradius);
+    std::vector<Vector> normals;
+    normals.resize(points.size(), zeroVec);
+    for(size_t i=0;i<points.size();++i){
+      // add data to the primitive
+      geo.appendVertex(QVector3D(points[i][0], points[i][1], points[i][2]));
+      if (ShapeFactory::getInstance().isSimpleShape(shape.getType()))
+        normals[i] = shape.getNormal(points[i]);
+      else
+        normals[i] = T.getNormal(points[i], &LinkedList);
+      geo.appendNormal(QVector3D(normals[i][0], normals[i][1], normals[i][2]));
+      geo.appendColor(QColor(1, 1, 1, 1));
+      geo.appendTexCoord(QVector2D(0, 0));
+    }
+  
+    // Fill the tesselated triangles into the geometry.
+    for (TriangleMap::const_iterator runner = T.TrianglesOnBoundary.begin(); runner != T.TrianglesOnBoundary.end(); runner++) {
+      int v[3];
+      for (size_t i=0; i<3; ++i)
+        v[i] = runner->second->endpoints[i]->node->getNr();
+  
+      // Sort the vertices so the triangle is clockwise (relative to the normal vector).
+      Vector cross = points[v[1]] - points[v[0]];
+      cross.VectorProduct(points[v[2]] - points[v[0]]);
+      if (cross.ScalarProduct(normals[v[0]] + normals[v[1]] + normals[v[2]]) > 0)
+        geo.appendIndices(v[0], v[1], v[2]);
+      else
+        geo.appendIndices(v[0], v[2], v[1]);
+    }
   }
 
