From d0d82b79fa6783106a61228fb9f94b103e82c842 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Tue, 16 May 2023 22:52:54 +0200 Subject: [PATCH] Fix crash when building Speck cache (closes #2689) --- modules/space/speckloader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/space/speckloader.cpp b/modules/space/speckloader.cpp index 8997c27fde..72e07d19d4 100644 --- a/modules/space/speckloader.cpp +++ b/modules/space/speckloader.cpp @@ -154,7 +154,7 @@ Dataset loadFile(std::filesystem::path path, SkipAllZeroLines skipAllZeroLines) // Guard against wrong line endings (copying files from Windows to Mac) causes // lines to have a final \r - if (line.back() == '\r') { + if (!line.empty() && line.back() == '\r') { line = line.substr(0, line.length() - 1); }