From 6c8a792176c951f2685dc5d8fa7600750cd65acf Mon Sep 17 00:00:00 2001 From: Fire Cube Date: Sat, 3 May 2025 21:50:44 +0200 Subject: [PATCH] handle file eof when readBin --- src/common/binary_helper.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/common/binary_helper.h b/src/common/binary_helper.h index de1bb9b78..366b1a13d 100644 --- a/src/common/binary_helper.h +++ b/src/common/binary_helper.h @@ -13,6 +13,10 @@ void writeBin(std::ostream& os, const T& v) { } template -void readBin(std::istream& is, T& v) { +void readBin(std::istream& is, T& v) { + if (is.eof()) { + LOG_WARNING(Render_Recompiler, "BinaryHelper: EOF"); + } + LOG_WARNING is.read(reinterpret_cast(&v), sizeof(T)); } \ No newline at end of file