File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Sources/SwiftProtobufPluginLibrary Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -683,10 +683,14 @@ public final class FieldDescriptor {
683683 // This logic comes from the C++ FieldDescriptor::is_packed() impl.
684684 // NOTE: It does not match what is in the C++ header for is_packed().
685685 guard isPackable else { return false }
686+ // The C++ imp also checks if the `options_` are null, but that is only for
687+ // their placeholder descriptor support, as once the FieldDescriptor is
688+ // fully wired it gets a default FileOptions instance, rendering nullptr
689+ // meaningless.
686690 if file. syntax == . proto2 {
687- return proto . hasOptions && proto . options. packed
691+ return options. packed
688692 } else {
689- return !proto . hasOptions || !proto . options. hasPacked || proto . options. packed
693+ return !options. hasPacked || options. packed
690694 }
691695 }
692696 /// True if this field is a map.
You can’t perform that action at this time.
0 commit comments