diff --git a/table.c b/table.c index d357f2e..fc6f866 100644 --- a/table.c +++ b/table.c @@ -125,6 +125,9 @@ int table_insert(struct table *t, void *entry) void *table_lookup(struct table *t, int idx) { + if (t->size < 1) + return NULL; + if (t->dirty) { t->lookup = realloc(t->lookup, t->size*sizeof(void *)); // TODO: check allocation