Skip to content

Fix netCDF crash when reading empty attributes

Kenneth Moreland requested to merge kmorel/vtk:netcdf-empty-attribute into master

When reading an attribute, vtkNetCDFCFReader would allocate an std::string of the appropriate length, then grab the C pointer from it and call the netCDF library to fill it with the value for the attribute. The problem was that if the attribute was zero-length, std::string would throw an exception if you tried to grab the pointer. Fix the problem by not loading any data if the length is 0.

Also added some defensive code for when reading cell bounds when there are no cells.

Merge request reports