summaryrefslogtreecommitdiff
path: root/src/stack.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stack.c')
-rw-r--r--src/stack.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/stack.c b/src/stack.c
index 21a8b35..c5e753e 100644
--- a/src/stack.c
+++ b/src/stack.c
@@ -25,7 +25,11 @@ void stack_push(stack_t *s, hash_table_t *h) {
s->stack[s->cur] = h;
}
-hash_table_t *stack_peek(stack_t *s) { return s->stack[s->cur]; }
+hash_table_t *stack_peek(stack_t *s) {
+ if (s->stack == NULL)
+ return NULL;
+ return s->stack[s->cur];
+}
hash_table_t *stack_pop(stack_t *s) {
hash_table_t *h = s->stack[s->cur];