aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--util/json.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/util/json.lua b/util/json.lua
index 05453703..cfa84a4b 100644
--- a/util/json.lua
+++ b/util/json.lua
@@ -134,12 +134,14 @@ end
function json.decode(json)
+ json = json.." "; -- appending a space ensures valid json wouldn't touch EOF
local pos = 1;
local current = {};
local stack = {};
local ch, peek;
local function next()
ch = json:sub(pos, pos);
+ if ch == "" then error("Unexpected EOF"); end
pos = pos+1;
peek = json:sub(pos, pos);
return ch;