Skip to content

Commit 3b08057

Browse files
committed
fix bug in PR #21620
would segfault when reaching the jl_datatype_nfields call
1 parent 0edc5fe commit 3b08057

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/codegen.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3048,7 +3048,7 @@ static bool emit_builtin_call(jl_cgval_t *ret, jl_value_t *f, jl_value_t **args,
30483048
jl_datatype_t *sty = (jl_datatype_t*)expr_type(args[1], ctx);
30493049
rt1 = (jl_value_t*)sty;
30503050
jl_datatype_t *uty = (jl_datatype_t*)jl_unwrap_unionall((jl_value_t*)sty);
3051-
if (jl_is_structtype(uty) && uty != jl_module_type) {
3051+
if (jl_is_structtype(uty) && uty != jl_module_type && ((jl_datatype_t*)uty)->layout) {
30523052
size_t idx = (size_t)-1;
30533053
if (jl_is_quotenode(args[2]) && jl_is_symbol(jl_fieldref(args[2],0))) {
30543054
idx = jl_field_index(uty, (jl_sym_t*)jl_fieldref(args[2],0), 0);

0 commit comments

Comments
 (0)