From: Igor Sysoev Date: Tue, 12 Jan 2016 17:09:33 +0000 (+0300) Subject: Segfault is fixed when script is terminated by unbalanced X-Git-Tag: 0.1.0~85 X-Git-Url: http://www.kaiwu.me/postgresql/commit/?a=commitdiff_plain;h=33fca9173302f1d34fd9fd9f11bde97c471e3ffa;p=njs.git Segfault is fixed when script is terminated by unbalanced closing brace. --- diff --git a/njs/njs_parser.c b/njs/njs_parser.c index 82138bcc..c7c61681 100644 --- a/njs/njs_parser.c +++ b/njs/njs_parser.c @@ -93,8 +93,7 @@ njs_parser(njs_vm_t *vm, njs_parser_t *parser) if (token == NJS_TOKEN_CLOSE_BRACE) { parser->lexer->start--; - - return parser->node; + break; } } diff --git a/njs/test/njs_unit_test.c b/njs/test/njs_unit_test.c index cc269072..2de1ae96 100644 --- a/njs/test/njs_unit_test.c +++ b/njs/test/njs_unit_test.c @@ -1582,11 +1582,9 @@ static njs_unit_test_t njs_test[] = "for (i in a) { if (a[i] > 4) break; s += a[i] } s"), nxt_string("10") }, -#if 0 { nxt_string("var a = [1,2,3,4,5]; var s = 0;" "for (i in a) if (a[i] > 4) break; s += a[i] } s"), - nxt_string("segfault") }, -#endif + nxt_string("5") }, /**/