Fix empty array unit test by reimplementing the node->children.size() test erroneously removed in r466

This commit is contained in:
Jason Turner 2010-01-07 01:47:04 +00:00
parent 31fec2202c
commit 3a4421a57c

View File

@ -345,12 +345,14 @@ namespace chaiscript
try { try {
Boxed_Value retval = ss.call_function("Vector"); Boxed_Value retval = ss.call_function("Vector");
for (i = 0; i < node->children[0]->children.size(); ++i) { if (node->children.size() > 0) {
try { for (i = 0; i < node->children[0]->children.size(); ++i) {
ss.call_function("push_back", retval, eval_token(ss, node->children[0]->children[i])); try {
} ss.call_function("push_back", retval, eval_token(ss, node->children[0]->children[i]));
catch (const dispatch_error &) { }
throw Eval_Error("Can not find appropriate 'push_back'", node->children[0]->children[i]); catch (const dispatch_error &) {
throw Eval_Error("Can not find appropriate 'push_back'", node->children[0]->children[i]);
}
} }
} }