[vtkusers] vtkIdTypeArray GetValue segfault?

David Doria daviddoria+vtk at gmail.com
Mon Jun 7 16:34:08 EDT 2010


I get an vtkIdTypeArray called "ids" like this:

vtkIdTypeArray* ids;
ids =
vtkIdTypeArray::SafeDownCast(selectedGraph->GetVertexData()->GetArray("vtkIdFilter_Ids"));

Then I check that it is valid:

if(!ids)
  break;

Then I check that it has the correct number of tuples:

std::cout << "ids has " << ids->GetNumberOfTuples() << " tuples." <<
std::endl;

Then I try to get a value from it:

 for(vtkIdType i = 0; i < ids->GetNumberOfTuples(); i++)
    {
    vtkIdType id = ids->GetValue(i); //segfault occurs here

but a segfault occurs where indicated above.

Anyone know why this might happen? Or what other conditions to check before
trying to access the data?

Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100607/1bbe0d18/attachment.htm>


More information about the vtkusers mailing list