From c1a5a5891fe17081fbfd23cfe56651c32cd75907 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 18 Feb 2019 23:51:15 -0800 Subject: structs: bugfix: slot_cache null check. * struct.c (struct_type_finalize): We must check slot_cache for null. The slot symbols of a struct type being finalized might not have slot caches. --- struct.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/struct.c b/struct.c index 049051bc..a2399a4d 100644 --- a/struct.c +++ b/struct.c @@ -211,12 +211,13 @@ static val struct_type_finalize(val obj) remhash(slot_hash, cons(slot, id)); - for (i = 0; i < SLOT_CACHE_SIZE; i++) - for (j = 0; j < 4; j++) - if (slot_cache[i][j].id == st->id) { - slot_cache[i][j].id = 0; - slot_cache[i][j].slot = 0; - } + if (slot_cache != 0) + for (i = 0; i < SLOT_CACHE_SIZE; i++) + for (j = 0; j < 4; j++) + if (slot_cache[i][j].id == st->id) { + slot_cache[i][j].id = 0; + slot_cache[i][j].slot = 0; + } } return nil; -- cgit v1.2.3