aboutsummaryrefslogtreecommitdiff
path: root/stack.c
diff options
context:
space:
mode:
authorKirill Petrashin <kirill8201@yandex.ru>2026-03-28 19:33:49 +0300
committerKirill Petrashin <kirill8201@yandex.ru>2026-03-28 19:33:49 +0300
commit1f0dd604952e39d030367b2bbf45b69f8c63cc5b (patch)
treea1389804dbb9301a6691704e4c5c0eb829df4a4b /stack.c
parent5b623c0a31d6732dd03ba8db80004e5468bc08c3 (diff)
downloadastar-1f0dd604952e39d030367b2bbf45b69f8c63cc5b.tar.xz
Allow resizing the map + some other stuff
Diffstat (limited to 'stack.c')
-rw-r--r--stack.c2
1 files changed, 2 insertions, 0 deletions
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];
}