summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzuu <zuu@openttd.org>2013-10-03 16:47:24 +0000
committerzuu <zuu@openttd.org>2013-10-03 16:47:24 +0000
commit8895ae5e0d1e6ad3f3962a6c9746bd5997e687fd (patch)
tree2df3d780f3b4c6b9e51fe70e4f2a02eadfb2ff06
parent3ad18962733360fd40ae2e5a5349f6fb67768c12 (diff)
downloadopenttd-8895ae5e0d1e6ad3f3962a6c9746bd5997e687fd.tar.xz
(svn r25809) -Fix: [Script] Decoding JSON data with an empty array from Admin port failed
-rw-r--r--src/script/api/script_event_types.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/script/api/script_event_types.cpp b/src/script/api/script_event_types.cpp
index 0e1683440..f22bb2f61 100644
--- a/src/script/api/script_event_types.cpp
+++ b/src/script/api/script_event_types.cpp
@@ -244,6 +244,14 @@ char *ScriptEventAdminPort::ReadValue(HSQUIRRELVM vm, char *p)
/* Array */
sq_newarray(vm, 0);
+ /* Empty array? */
+ char *p2 = p+1;
+ SKIP_EMPTY(p2);
+ if (*p2 == ']') {
+ p = p2+1;
+ break;
+ }
+
while (*p++ != ']') {
p = this->ReadValue(vm, p);
if (p == NULL) {