<div>I noticed this problem a while back:</div><a href="http://public.kitware.com/Bug/view.php?id=9814">http://public.kitware.com/Bug/view.php?id=9814</a><div><br></div><div>The demo file I added to the bug contains a triangle cell but 0 points. Clearly this is a bad situation. It doesn't crash the XMLPolyDataReader, but if you load the file in Paraview, the call stack shows:</div>
<div><br></div><div>vtkDataArrayTemplate<float>::GetTuple (line 613)</div><div>vtkPoints::GetPoint</div><div>vtkPolygon::ComputeNormal</div><div>PVGeometryFilter::ExecuteCellNormals</div><div><br></div><div>The problem occurs on line 610 of vtkDataArrayTemplate.txx - 't' is NULL, so then on line 613 it segfaults.</div>
<div><br></div><div>Is this type of thing where we would want to allow a crash (the assumption being that only good data files are loaded)? Or could we change:</div><div><br></div><div><div>template <class T></div><div>
void vtkDataArrayTemplate<T>::GetTuple(vtkIdType i, double* tuple)</div><div>{</div><div> T* t = this->Array + this->NumberOfComponents*i;</div><div> for(int j=0; j < this->NumberOfComponents; ++j)</div>
<div> {</div><div> tuple[j] = static_cast<double>(t[j]);</div><div> }</div><div>}</div><div><br></div><div>to something like:</div><div><br></div><div><div>template <class T></div><div>void vtkDataArrayTemplate<T>::GetTuple(vtkIdType i, double* tuple)</div>
<div>{</div><div> T* t = this->Array + this->NumberOfComponents*i;</div><div><br></div><div> if(!t)</div><div> {</div><div> return;</div><div> }</div><div><br></div><div> for(int j=0; j < this->NumberOfComponents; ++j)</div>
<div> {</div><div> tuple[j] = static_cast<double>(t[j]);</div><div> }</div><div>}</div></div></div><div><br clear="all">Thanks,<br><br>David<br>
</div>