From 0f65198509218f00dd22c4aad3822601d872a8b3 Mon Sep 17 00:00:00 2001 From: Howard Butler Date: Tue, 30 Nov 2021 14:43:16 -0600 Subject: [PATCH] guard for situations when we don't have GPStime stats (#96) * guard for situations when we don't have GPStime stats * init gps stats --- bu/CopcSupport.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bu/CopcSupport.cpp b/bu/CopcSupport.cpp index 72860a6..d707f21 100644 --- a/bu/CopcSupport.cpp +++ b/bu/CopcSupport.cpp @@ -117,8 +117,14 @@ void CopcSupport::updateHeader(const StatsMap& stats) m_header.minx = stats.at(Id::X).minimum(); m_header.miny = stats.at(Id::Y).minimum(); m_header.minz = stats.at(Id::Z).minimum(); - m_copcVlr.gpstime_minimum = stats.at(Id::GpsTime).minimum(); - m_copcVlr.gpstime_maximum = stats.at(Id::GpsTime).maximum(); + + m_copcVlr.gpstime_minimum = 0.0f; + m_copcVlr.gpstime_maximum = 0.0f; + if (stats.count(Id::GpsTime)) + { + m_copcVlr.gpstime_minimum = stats.at(Id::GpsTime).minimum(); + m_copcVlr.gpstime_maximum = stats.at(Id::GpsTime).maximum(); + } for (int i = 1; i <= 15; ++i) {