summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-02-18 23:51:15 -0800
committerKaz Kylheku <kaz@kylheku.com>2019-02-18 23:51:15 -0800
commitc1a5a5891fe17081fbfd23cfe56651c32cd75907 (patch)
tree70d40e4e4d10446d62b9cd36280f312c36850bb0
parent15f230fb10c76b54dad3f8786ac3fd7b9bd98894 (diff)
downloadtxr-c1a5a5891fe17081fbfd23cfe56651c32cd75907.tar.gz
txr-c1a5a5891fe17081fbfd23cfe56651c32cd75907.tar.bz2
txr-c1a5a5891fe17081fbfd23cfe56651c32cd75907.zip
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.
-rw-r--r--struct.c13
1 files 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;