From 68b66729079bcf91ef44701c939f858f7ae9fe29 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Fri, 8 Apr 2022 09:41:26 +0200 Subject: [PATCH] Fixed detection of config data at the end of gcode files --- src/libslic3r/Config.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/Config.cpp b/src/libslic3r/Config.cpp index 18b97665d..6f77c5f30 100644 --- a/src/libslic3r/Config.cpp +++ b/src/libslic3r/Config.cpp @@ -822,8 +822,12 @@ public: return false; m_file_pos -= m_block_len; m_ifs.seekg(m_file_pos, m_ifs.beg); - if (! m_ifs.read(m_block.data(), m_block_len)) - return false; + m_ifs.read(m_block.data(), m_block_len); + if (!m_ifs.good()) { + if (!m_ifs.eof()) + return false; + m_block_len = m_ifs.gcount(); + } } assert(m_block_len > 0);