bug fixes for stand-alone compiles with empty records

This commit is contained in:
Vern Paxson 2021-05-05 19:32:30 -07:00
parent 2b0f1c9d6e
commit ac257e4a86

View file

@ -151,6 +151,10 @@ void CPPCompile::ExpandListTypeVar(const TypePtr& t, string& tn)
void CPPCompile::ExpandRecordTypeVar(const TypePtr& t, string& tn) void CPPCompile::ExpandRecordTypeVar(const TypePtr& t, string& tn)
{ {
auto r = t->AsRecordType()->Types(); auto r = t->AsRecordType()->Types();
if ( ! r )
return;
auto t_name = tn + "->AsRecordType()"; auto t_name = tn + "->AsRecordType()";
AddInit(t, string("if ( ") + t_name + "->NumFields() == 0 )"); AddInit(t, string("if ( ") + t_name + "->NumFields() == 0 )");
@ -476,6 +480,9 @@ void CPPCompile::RegisterRecordType(const TypePtr& t)
{ {
auto r = t->AsRecordType()->Types(); auto r = t->AsRecordType()->Types();
if ( ! r )
return;
for ( auto i = 0; i < r->length(); ++i ) for ( auto i = 0; i < r->length(); ++i )
{ {
const auto& r_i = (*r)[i]; const auto& r_i = (*r)[i];