diff --git a/FileIO/TINInterface.cpp b/FileIO/TINInterface.cpp index 84df0339161d659c859a87e7d415fe7853cce21b..c543e7331841387ac06f9490fa00b92af570e41c 100644 --- a/FileIO/TINInterface.cpp +++ b/FileIO/TINInterface.cpp @@ -121,6 +121,10 @@ GeoLib::Surface* TINInterface::readTIN(std::string const& fname, void TINInterface::writeSurfaceAsTIN(GeoLib::Surface const& surface, std::string const& file_name) { std::ofstream os (file_name.c_str()); + if (!os) { + WARN("writeSurfaceAsTIN(): could not open stream to %s.", file_name.c_str()); + return; + } os.precision(std::numeric_limits<double>::digits10); const std::size_t n_tris (surface.getNTriangles()); for (std::size_t l(0); l < n_tris; l++) {