From 86bf28945281671cc2c03066d24179660b11faf1 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Mon, 30 Sep 2024 22:26:00 +0200 Subject: [PATCH] Process the last line of textual palette specs even without a trailing newline Fixes #1519 --- src/gfx/pal_spec.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gfx/pal_spec.cpp b/src/gfx/pal_spec.cpp index cfeefd7f..d36b272f 100644 --- a/src/gfx/pal_spec.cpp +++ b/src/gfx/pal_spec.cpp @@ -211,11 +211,12 @@ static T readLE(U const *bytes) { [[gnu::warn_unused_result]] // Ignoring EOF is a bad idea. static bool readLine(std::filebuf &file, std::string &buffer) { + assume(buffer.empty()); // TODO: maybe this can be optimized to bulk reads? for (;;) { auto c = file.sbumpc(); if (c == std::filebuf::traits_type::eof()) { - return false; + return !buffer.empty(); } if (c == '\n') { // Discard a trailing CRLF