Fix empty array unit test by reimplementing the node->children.size() test erroneously removed in r466
This commit is contained in:
parent
31fec2202c
commit
3a4421a57c
@ -345,12 +345,14 @@ namespace chaiscript
|
||||
|
||||
try {
|
||||
Boxed_Value retval = ss.call_function("Vector");
|
||||
for (i = 0; i < node->children[0]->children.size(); ++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]);
|
||||
if (node->children.size() > 0) {
|
||||
for (i = 0; i < node->children[0]->children.size(); ++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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user