From 4941f2f2a492c993be13214348ff3343019f0dac Mon Sep 17 00:00:00 2001 From: mwlasiuk Date: Mon, 12 Oct 2026 18:40:58 +0200 Subject: [PATCH] Apply checks for benchmark orchestration --- apps/console_tools/laz_to_ply.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/apps/console_tools/laz_to_ply.cpp b/apps/console_tools/laz_to_ply.cpp index 251b66a7..e066204f 100644 --- a/apps/console_tools/laz_to_ply.cpp +++ b/apps/console_tools/laz_to_ply.cpp @@ -45,7 +45,7 @@ bool convert_and_save(const char* from, const char* to) } laszip_point* point = nullptr; - if (laszip_get_point_pointer(header, &point)) + if (laszip_get_point_pointer(laszip_reader, &point)) { return false; } @@ -57,7 +57,7 @@ bool convert_and_save(const char* from, const char* to) laszip_I64 point_read_count = 0; while (point_read_count < point_count) { - if (laszip_read_point(header)) + if (laszip_read_point(laszip_reader)) { return false; } @@ -71,6 +71,12 @@ bool convert_and_save(const char* from, const char* to) point_read_count++; } + if (laszip_close_reader(laszip_reader) || laszip_destroy(laszip_reader)) + { + spdlog::error("Failed closing LASzip reader"); + return false; + } + if (std::ofstream to_file = std::ofstream(to, std::ios::out | std::ios::binary)) { to_file << "ply\n"; @@ -84,6 +90,12 @@ bool convert_and_save(const char* from, const char* to) to_file << "end_header\n"; to_file.write((const char*)points.data(), points.size() * sizeof(Point)); + to_file.close(); + if (!to_file) + { + spdlog::error("Failed writing PLY output {}", to); + return false; + } } else {