From 60428ad83a37ae14cb6c35b7f2d124b7c3762f0c Mon Sep 17 00:00:00 2001 From: Andrew Bell Date: Tue, 9 Feb 2021 12:14:35 -0500 Subject: [PATCH] Set the VLR offsets to 0 if there are no offsets. --- io/LasWriter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/io/LasWriter.cpp b/io/LasWriter.cpp index a7e3d2dcde..5072bf0ded 100644 --- a/io/LasWriter.cpp +++ b/io/LasWriter.cpp @@ -343,7 +343,7 @@ void LasWriter::prepOutput(std::ostream *outStream, const SpatialReference& srs) OLeStream out(m_ostream); out << m_lasHeader; - m_lasHeader.setVlrOffset((uint32_t)m_ostream->tellp()); + m_lasHeader.setVlrOffset(m_vlrs.size() ? (uint32_t)m_ostream->tellp() : 0); for (auto vi = m_vlrs.begin(); vi != m_vlrs.end(); ++vi) { @@ -1169,7 +1169,7 @@ void LasWriter::finishOutput() OLeStream out(m_ostream); // addVlr prevents any eVlrs from being added before version 1.4. - m_lasHeader.setEVlrOffset((uint32_t)m_ostream->tellp()); + m_lasHeader.setEVlrOffset(m_eVlrs.size() ? (uint32_t)m_ostream->tellp() : 0); for (auto vi = m_eVlrs.begin(); vi != m_eVlrs.end(); ++vi) { ExtLasVLR evlr = *vi;