From 5ecf1f46aae4994662bd8e3df189f8d60b49a304 Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Thu, 5 Jan 2023 21:02:26 -0800 Subject: bind works for real, I think this works now --- src/stack.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/stack.c') 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]; -- cgit