diff options
author | Preston Pan <preston@nullring.xyz> | 2023-01-05 21:02:26 -0800 |
---|---|---|
committer | Preston Pan <preston@nullring.xyz> | 2023-01-05 21:02:26 -0800 |
commit | 5ecf1f46aae4994662bd8e3df189f8d60b49a304 (patch) | |
tree | 91b6a15d65c9e8d7a5e7ae87712830b1bf4f4eca /src/stack.c | |
parent | 7ff373076c59af3ba166e5080b8ecead569d5a44 (diff) |
bind works for real, I think this works now
Diffstat (limited to 'src/stack.c')
-rw-r--r-- | src/stack.c | 6 |
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]; |