Skip to content

Commit 2e1e7c1

Browse files
author
meister
committed
Fix an assert
1 parent 8a37045 commit 2e1e7c1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/core/dtree-interpreter.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,13 @@ case MAYBE_LONG_ADD + DTREE_OP_SLOT_READ: {
126126
DTILOG(" location: %s name: %s\n", _safe_rep_(location), _safe_rep_(slot_name));
127127
size_t index = location.unsafe_fixnum();
128128
DTILOG("Got tinstance@%p %s\n", (void*)arg.raw_(), _safe_rep_(arg));
129-
Instance_sp instance = gc::As_assert<Instance_sp>(arg);
129+
130+
#ifdef DEBUG_ASSERT
131+
if (!(gc::IsA<Instance_sp>(arg) || gc::IsA<FuncallableInstance_sp>(arg))) {
132+
THROW_HARD_ERROR("arg = {} must be an Instance_sp or FuncallableInstance_sp",(void*)arg.raw_());
133+
}
134+
#endif
135+
Instance_sp instance = gc::As_unsafe<Instance_sp>(arg);
130136
DTILOG("instance %p index %lu\n", (void*)instance.raw_(), index);
131137
T_sp value = instance->instanceRef(index);
132138
if (value.unboundp()) {

0 commit comments

Comments
 (0)