diff --git a/src/google/protobuf/compiler/retention.cc b/src/google/protobuf/compiler/retention.cc index f34259eb1b..87901288ca 100644 --- a/src/google/protobuf/compiler/retention.cc +++ b/src/google/protobuf/compiler/retention.cc @@ -299,8 +299,7 @@ MessageOptions StripLocalSourceRetentionOptions(const Descriptor& descriptor) { ExtensionRangeOptions StripLocalSourceRetentionOptions( const Descriptor& descriptor, const Descriptor::ExtensionRange& range) { - if (range.options_ == nullptr) return ExtensionRangeOptions{}; - ExtensionRangeOptions options = *range.options_; + ExtensionRangeOptions options = range.options(); ConvertToDynamicMessageAndStripOptions(options, GetPool(descriptor)); return options; } diff --git a/src/google/protobuf/retention_test.cc b/src/google/protobuf/retention_test.cc index 192533cc8b..4e5af2d1a1 100644 --- a/src/google/protobuf/retention_test.cc +++ b/src/google/protobuf/retention_test.cc @@ -160,7 +160,8 @@ TEST(RetentionTest, ExtensionRange) { CheckOptionsMessageIsStrippedCorrectly( protobuf_unittest::TopLevelMessage::descriptor() ->extension_range(0) - ->options_->GetExtension(protobuf_unittest::extension_range_option)); + ->options() + .GetExtension(protobuf_unittest::extension_range_option)); } TEST(RetentionTest, Service) {