From 83fc2deeef2611c8e29b2048868767088e8cfffb Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 3 Nov 2024 14:17:01 +0000 Subject: Throw if input stream not in good state reading JSON --- lib/jsonParse-persistence.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/jsonParse-persistence.h b/lib/jsonParse-persistence.h index 6edebc7..e4e64c0 100644 --- a/lib/jsonParse-persistence.h +++ b/lib/jsonParse-persistence.h @@ -15,6 +15,9 @@ namespace Persistence { inline T loadState(std::istream & in) { + if (!in.good()) { + throw std::runtime_error("Input stream not in good state"); + } T t {}; stk.push(std::make_unique>(std::ref(t))); loadState(in); -- cgit v1.2.3