diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-02-18 23:51:15 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-02-18 23:51:15 -0800 |
commit | c1a5a5891fe17081fbfd23cfe56651c32cd75907 (patch) | |
tree | 70d40e4e4d10446d62b9cd36280f312c36850bb0 | |
parent | 15f230fb10c76b54dad3f8786ac3fd7b9bd98894 (diff) | |
download | txr-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.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -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; |