]> ocean-lang.org Git - ocean/blobdiff - csrc/parsergen.mdc
parsergen: Don't look beyond the bottom of stack...
[ocean] / csrc / parsergen.mdc
index 37dcf7eb12a1348e6a07378f2cbf67cf7fa78ffc..2cfcb45491d6f91f54e3dab24124c076c95e40b1 100644 (file)
@@ -2530,7 +2530,7 @@ at the start of a production.
                                // will fail).
                        }
                        if (p.next.sym == TK_newline) {
-                               if (! p.stack[p.tos-1].newline_permitted) {
+                               if (!p.tos || ! p.stack[p.tos-1].newline_permitted) {
                                        free(tk);
                                        tk = NULL;
                                        continue;