diff --git a/peglib.h b/peglib.h index 47dd3da..6be2b14 100644 --- a/peglib.h +++ b/peglib.h @@ -1576,7 +1576,7 @@ class Cut : public Ope, public std::enable_shared_from_this { public: size_t parse_core(const char * /*s*/, size_t /*n*/, SemanticValues & /*vs*/, Context &c, std::any & /*dt*/) const override { - c.cut_stack.back() = true; + if (!c.cut_stack.empty()) { c.cut_stack.back() = true; } return 0; }