Skip to content

Commit

Permalink
Dang. Hash tables had a bug where looking up a non-existent key would…
Browse files Browse the repository at this point in the history
… cause a seg fault. Fixed.
  • Loading branch information
rthelen committed Apr 28, 2010
1 parent e615979 commit 50ce7b7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion fhash.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ static fobj_t **fhash_key_index(fenv_t *f, fhash_t *h, fobj_t *key)

static fobj_t *fhash_key_fetch(fenv_t *f, fhash_t *h, fobj_t *key)
{
return *fhash_key_index(f, h, key);
fobj_t **val = fhash_key_index(f, h, key);

if (val) {
return *val;
} else {
return NULL;
}
}

static void fhash_key_store(fenv_t *f, fhash_t *h, fobj_t *key, fobj_t *data)
Expand Down

0 comments on commit 50ce7b7

Please sign in to comment.