summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-11-03 14:17:01 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-11-03 14:19:02 +0000
commit83fc2deeef2611c8e29b2048868767088e8cfffb (patch)
tree54a8b575db0495a31215369a44812c9faf601f0f
parentReuse close vertices when deforming terrain (diff)
downloadilt-83fc2deeef2611c8e29b2048868767088e8cfffb.tar.bz2
ilt-83fc2deeef2611c8e29b2048868767088e8cfffb.tar.xz
ilt-83fc2deeef2611c8e29b2048868767088e8cfffb.zip
Throw if input stream not in good state reading JSON
-rw-r--r--lib/jsonParse-persistence.h3
1 files changed, 3 insertions, 0 deletions
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<SelectionT<T>>(std::ref(t)));
loadState(in);