mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-06 05:27:24 +00:00
add the missing checkNullConditionnal code in the "GenObjApi" function when the field is scalar optional (#7114)
This commit is contained in:
@@ -1079,6 +1079,9 @@ class TsGenerator : public BaseGenerator {
|
||||
if (has_create) {
|
||||
pack_func_create_call += field_offset_val;
|
||||
} else {
|
||||
if (field.IsScalarOptional()) {
|
||||
pack_func_create_call += " if (" + field_offset_val + " !== null)\n ";
|
||||
}
|
||||
pack_func_create_call += " " + struct_name + ".add" +
|
||||
MakeCamel(field.name) + "(builder, " +
|
||||
field_offset_val + ");\n";
|
||||
|
||||
Reference in New Issue
Block a user