Skip to content

Commit 93fa69f

Browse files
committed
Correct the encoder for the default optional case
1 parent a4b748a commit 93fa69f

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/mfast/coder/encoder_v2/fast_encoder_core.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,11 @@ void fast_encoder_core::encode_field(const T &ext_ref, default_operator_tag,
470470
return;
471471
}
472472

473+
if (ext_ref.optional() && !ext_ref.present()) {
474+
pmap.set_next_bit(false);
475+
return;
476+
}
477+
473478
pmap.set_next_bit(true);
474479
if (!ext_ref.present()) {
475480
// A NULL indicates that the value is absent and the state of the previous

0 commit comments

Comments
 (0)