From 1f0dd604952e39d030367b2bbf45b69f8c63cc5b Mon Sep 17 00:00:00 2001 From: Kirill Petrashin Date: Sat, 28 Mar 2026 19:33:49 +0300 Subject: Allow resizing the map + some other stuff --- stack.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'stack.c') diff --git a/stack.c b/stack.c index 1edb5c5..f0624c8 100644 --- a/stack.c +++ b/stack.c @@ -18,11 +18,13 @@ int ps_push(PositionStack *ps, Position pos) { } Position ps_pop(PositionStack *ps) { + if (ps->top == 0) error("Stack underflow\n"); ps->top -= 1; return ps->arr[ps->top]; } Position ps_peek(PositionStack ps) { + if (ps.top == 0) error("Stack underflow\n"); return ps.arr[ps.top - 1]; } -- cgit v1.2.3