diff --git a/Common/DataModel/vtkPolyData.cxx b/Common/DataModel/vtkPolyData.cxx
index 8f1c231..64df50d 100644
--- a/Common/DataModel/vtkPolyData.cxx
+++ b/Common/DataModel/vtkPolyData.cxx
@@ -974,11 +974,19 @@ void vtkPolyData::BuildCells()
     {
     vtkIdType *pLines = lineCells->GetData()->GetPointer(0);
     numCellPts = pLines[0];
+    if (numCellPts < 2)
+      {
+      vtkErrorMacro(<<"Bad line! Less than 2 points!");
+      }
     pLocs[0] = 0;
     pTypes[0] = numCellPts > 2 ? VTK_POLY_LINE : VTK_LINE;
     nextCellPts = numCellPts + 1;
     for (vtkIdType i = 1; i < nLines; ++i)
       {
+      if (numCellPts < 2)
+        {
+        vtkErrorMacro(<<"Bad line! Less than 2 points!");
+        }
       numCellPts = pLines[nextCellPts];
       pLocs[i] = nextCellPts;
       pTypes[i] = numCellPts > 2 ? VTK_POLY_LINE : VTK_LINE;
