diff --git a/oi/CodeGen.cpp b/oi/CodeGen.cpp index 77875df..3ff0bc5 100644 --- a/oi/CodeGen.cpp +++ b/oi/CodeGen.cpp @@ -663,15 +663,16 @@ void CodeGen::getClassTypeHandler(const Class& c, std::string& code) { // the entire type instead of delegating the next part. std::string traverser; { - if (!c.members.empty()) { - traverser = "auto ret = returnArg"; - } for (size_t i = 0; i < lastNonPaddingElement + 1; i++) { const auto& member = c.members[i]; if (member.name.starts_with(type_graph::AddPadding::MemberPrefix)) { continue; } + if (traverser.empty()) { + traverser = "auto ret = returnArg"; + } + if (thriftIssetMember != nullptr && thriftIssetMember != &member) { traverser += "\n .write(getThriftIsset(t, " + std::to_string(i) + "))"; }