Skip to content

Commit

Permalink
Fix naked_ptr issue
Browse files Browse the repository at this point in the history
  • Loading branch information
nolankramer committed Sep 25, 2024
1 parent c7a8102 commit 707349c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/idl_gen_cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3380,14 +3380,18 @@ class CppGenerator : public BaseGenerator {

if (is_pointer) {
code += "{ if(" + out_field + ") { ";
code += "_e->UnPackTo(" + out_field + ".get(), _resolver);";
code += "_e->UnPackTo(" + out_field + GenPtrGet(field) + ", _resolver);";
code += " } else { ";
}
code += out_field + " = ";
code += GenUnpackVal(field.value.type, "_e", false, field) + ";";
if (is_pointer) {
code += " } } else if (" + out_field + ") { " + out_field +
".reset(); }";
code += " } } else if (" + out_field + ") { " + out_field;
if (PtrType(&field) == "naked") {
code += " = nullptr; }";
} else {
code += ".reset(); }";
}
}
}
break;
Expand Down

0 comments on commit 707349c

Please sign in to comment.