summaryrefslogtreecommitdiffstats
path: root/cmsg.cpp
diff options
context:
space:
mode:
authoredwin <edwin@99606f1f-bbb2-4562-8e6b-387ddef1dc61>2010-05-16 21:53:17 (GMT)
committer edwin <edwin@99606f1f-bbb2-4562-8e6b-387ddef1dc61>2010-05-16 21:53:17 (GMT)
commit37656dd425f46e0711f5d792cb918d97a8e5d371 (patch)
tree96614cd4919da767549f8e69b41366e3a407f449 /cmsg.cpp
parentbb6e8d221ccf0f193f706781ee22a54e7cb3a6c2 (diff)
added plain array support to Cvar
git-svn-id: https://open.syn3.nl/syn3/svndav/default/trunk/projects/synapse@326 99606f1f-bbb2-4562-8e6b-387ddef1dc61
Diffstat (limited to 'cmsg.cpp')
-rw-r--r--cmsg.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/cmsg.cpp b/cmsg.cpp
index 76d7896..b51739f 100644
--- a/cmsg.cpp
+++ b/cmsg.cpp
@@ -59,9 +59,12 @@ bool Cmsg::fromJson(string & jsonStr)
//TODO:how safe is it actually to let json_spirit parse untrusted input? (regarding DoS, buffer overflows, etc)
json_spirit::read(jsonStr, spiritMsg);
- src=spiritMsg.get_array()[0].get_int();
- dst=spiritMsg.get_array()[1].get_int();
- event=spiritMsg.get_array()[2].get_str();
+ if (spiritMsg.get_array().size()>2)
+ {
+ src=spiritMsg.get_array()[0].get_int();
+ dst=spiritMsg.get_array()[1].get_int();
+ event=spiritMsg.get_array()[2].get_str();
+ }
if (spiritMsg.get_array().size()>3)
fromJsonSpirit(spiritMsg.get_array()[3]);
return true;