Skip to content

Commit bd82150

Browse files
committed
Add a diagnostic message rather than segfaulting on a closure having a missing outer context pointer.
1 parent 47ed8e9 commit bd82150

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/6model/serialization.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,10 @@ static Parrot_Int4 get_serialized_context_idx(PARROT_INTERP, SerializationWriter
347347
static Parrot_Int4 get_serialized_outer_context_idx(PARROT_INTERP, SerializationWriter *writer, PMC *closure) {
348348
if (!PMC_IS_NULL(VTABLE_getprop(interp, closure, Parrot_str_new_constant(interp, "COMPILER_STUB"))))
349349
return 0;
350+
if (PMC_IS_NULL(PARROT_SUB(closure)->outer_ctx))
351+
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
352+
"Serialization Error: missing outer context for closure '%Ss'",
353+
VTABLE_get_string(interp, closure));
350354
return get_serialized_context_idx(interp, writer, PARROT_SUB(closure)->outer_ctx);
351355
}
352356

0 commit comments

Comments
 (0)