diff --git a/src/scripting/types.cpp b/src/scripting/types.cpp index f07356d42..91ceb9077 100644 --- a/src/scripting/types.cpp +++ b/src/scripting/types.cpp @@ -2247,6 +2247,7 @@ bool PStruct::ReadValue(FSerializer &ar, const char *key, void *addr) const PField *PStruct::AddField(FName name, PType *type, uint32_t flags) { + assert(type->Size > 0); return Symbols.AddField(name, type, flags, Size, &Align); } diff --git a/src/scripting/zscript/zcc_compile.cpp b/src/scripting/zscript/zcc_compile.cpp index 5d42d64ba..71f8e6d35 100644 --- a/src/scripting/zscript/zcc_compile.cpp +++ b/src/scripting/zscript/zcc_compile.cpp @@ -1298,6 +1298,11 @@ bool ZCCCompiler::CompileFields(PContainerType *type, TArrayNames; do { + if (fieldtype->Size == 0 && !(varflags & VARF_Native)) // Size not known yet. + { + return false; + } + if (AddTreeNode(name->Name, name, TreeNodes, !forstruct)) { auto thisfieldtype = fieldtype;