Added check to avoid crash when outputting an empty file.

Added the suggested fixes to avoid a crash when converting from an empty tck file to the vtk format.